|
18 | 18 | package org.apache.cloudstack.vnf.service; |
19 | 19 |
|
20 | 20 | import com.cloud.exception.CloudException; |
21 | | -import com.cloud.network.Network; |
22 | | -import org.apache.cloudstack.vnf.entity.VnfApplianceVO; |
| 21 | +import org.apache.cloudstack.vnf.api.command.*; |
| 22 | +import org.apache.cloudstack.vnf.api.response.*; |
| 23 | + |
23 | 24 | import org.apache.cloudstack.vnf.entity.VnfDictionaryVO; |
24 | | -import org.apache.cloudstack.vnf.entity.VnfReconciliationLogVO; |
| 25 | +import org.apache.cloudstack.vnf.entity.VnfInstanceVO; |
| 26 | +import org.apache.cloudstack.vnf.VnfConnectivityResult; |
| 27 | +import org.apache.cloudstack.vnf.VnfReconciliationResult; |
25 | 28 |
|
26 | 29 | import java.util.List; |
27 | 30 |
|
28 | 31 | /** |
29 | | - * VnfService - Main service interface for VNF Framework operations |
| 32 | + * VnfService - Core service interface for VNF Framework operations. |
| 33 | + * Aligned with API command contract for clean design. |
30 | 34 | */ |
31 | 35 | public interface VnfService { |
32 | | - |
33 | | - // ===================================================== |
| 36 | + |
34 | 37 | // Dictionary Management |
35 | | - // ===================================================== |
36 | | - |
37 | | - /** |
38 | | - * Create or update a VNF dictionary |
39 | | - */ |
40 | | - VnfDictionaryVO createOrUpdateDictionary(Long templateId, Long networkId, String name, String yamlContent) throws CloudException; |
41 | | - |
42 | | - /** |
43 | | - * Get dictionary for a template or network |
44 | | - * Network-specific dictionary takes precedence over template dictionary |
45 | | - */ |
46 | | - VnfDictionaryVO getDictionary(Long templateId, Long networkId) throws CloudException; |
47 | | - |
48 | | - /** |
49 | | - * Delete a dictionary by UUID |
50 | | - */ |
51 | | - boolean deleteDictionary(String uuid) throws CloudException; |
52 | | - |
53 | | - /** |
54 | | - * List all active dictionaries |
55 | | - */ |
56 | | - List<VnfDictionaryVO> listDictionaries(); |
57 | | - |
58 | | - /** |
59 | | - * Parse and validate dictionary YAML |
60 | | - */ |
61 | | - boolean validateDictionary(String yamlContent) throws CloudException; |
62 | | - |
63 | | - // ===================================================== |
64 | | - // VNF Appliance Management |
65 | | - // ===================================================== |
66 | | - |
67 | | - /** |
68 | | - * Deploy a VNF appliance for a network |
69 | | - */ |
70 | | - VnfApplianceVO deployVnfAppliance(Long networkId, Long templateId, Long vmInstanceId) throws CloudException; |
71 | | - |
72 | | - /** |
73 | | - * Get VNF appliance for a network |
74 | | - */ |
75 | | - VnfApplianceVO getVnfApplianceForNetwork(Long networkId); |
76 | | - |
77 | | - /** |
78 | | - * Get VNF appliance by UUID |
79 | | - */ |
80 | | - VnfApplianceVO getVnfAppliance(String uuid); |
81 | | - |
82 | | - /** |
83 | | - * Update appliance state |
84 | | - */ |
85 | | - VnfApplianceVO updateApplianceState(Long applianceId, VnfApplianceVO.VnfState state) throws CloudException; |
86 | | - |
87 | | - /** |
88 | | - * Update appliance health status |
89 | | - */ |
90 | | - VnfApplianceVO updateHealthStatus(Long applianceId, VnfApplianceVO.HealthStatus status) throws CloudException; |
91 | | - |
92 | | - /** |
93 | | - * List all active appliances |
94 | | - */ |
95 | | - List<VnfApplianceVO> listAppliances(); |
96 | | - |
97 | | - /** |
98 | | - * List appliances by state |
99 | | - */ |
100 | | - List<VnfApplianceVO> listAppliancesByState(VnfApplianceVO.VnfState state); |
101 | | - |
102 | | - /** |
103 | | - * Destroy a VNF appliance |
104 | | - */ |
105 | | - boolean destroyVnfAppliance(Long applianceId) throws CloudException; |
106 | | - |
107 | | - // ===================================================== |
108 | | - // Health Check Operations |
109 | | - // ===================================================== |
110 | | - |
111 | | - /** |
112 | | - * Perform health check on a VNF appliance |
113 | | - */ |
114 | | - boolean performHealthCheck(Long applianceId) throws CloudException; |
115 | | - |
116 | | - /** |
117 | | - * Perform health checks on all running appliances |
118 | | - */ |
119 | | - List<VnfApplianceVO> performHealthChecks(); |
120 | | - |
121 | | - /** |
122 | | - * Get appliances with stale last contact time |
123 | | - */ |
124 | | - List<VnfApplianceVO> getStaleAppliances(int minutesStale); |
125 | | - |
126 | | - // ===================================================== |
127 | | - // Reconciliation Operations |
128 | | - // ===================================================== |
129 | | - |
130 | | - /** |
131 | | - * Reconcile a network's rules with VNF device |
132 | | - * @param networkId Network to reconcile |
133 | | - * @param dryRun If true, only detect drift without fixing |
134 | | - * @return Reconciliation log |
135 | | - */ |
136 | | - VnfReconciliationLogVO reconcileNetwork(Long networkId, boolean dryRun) throws CloudException; |
137 | | - |
138 | | - /** |
139 | | - * Get latest reconciliation result for a network |
140 | | - */ |
141 | | - VnfReconciliationLogVO getLatestReconciliation(Long networkId); |
142 | | - |
143 | | - /** |
144 | | - * List all reconciliations for a network |
145 | | - */ |
146 | | - List<VnfReconciliationLogVO> listReconciliations(Long networkId); |
147 | | - |
148 | | - /** |
149 | | - * List reconciliations with drift detected |
150 | | - */ |
151 | | - List<VnfReconciliationLogVO> listDriftReconciliations(); |
152 | | - |
153 | | - // ===================================================== |
| 38 | + VnfDictionaryResponse uploadVnfDictionary(UploadVnfDictionaryCmd cmd) throws CloudException; |
| 39 | + List<VnfDictionaryResponse> listVnfDictionaries(ListVnfDictionariesCmd cmd); |
| 40 | + |
154 | 41 | // Firewall Rule Operations |
155 | | - // ===================================================== |
156 | | - |
157 | | - /** |
158 | | - * Apply a firewall rule to VNF device |
159 | | - * @param ruleId CloudStack firewall rule ID |
160 | | - * @return External ID from VNF device |
161 | | - */ |
162 | | - String applyFirewallRule(Long ruleId) throws CloudException; |
163 | | - |
164 | | - /** |
165 | | - * Delete a firewall rule from VNF device |
166 | | - * @param ruleId CloudStack firewall rule ID |
167 | | - */ |
168 | | - boolean deleteFirewallRule(Long ruleId) throws CloudException; |
169 | | - |
170 | | - /** |
171 | | - * List firewall rules on VNF device |
172 | | - */ |
173 | | - List<String> listFirewallRules(Long networkId) throws CloudException; |
174 | | - |
175 | | - // ===================================================== |
176 | | - // Query Operations |
177 | | - // ===================================================== |
178 | | - |
179 | | - /** |
180 | | - * Get VNF operation audit logs |
181 | | - */ |
182 | | - List<Object> getOperationAuditLogs(Long applianceId, String operation, int limit); |
183 | | - |
184 | | - /** |
185 | | - * Get failed operations for troubleshooting |
186 | | - */ |
187 | | - List<Object> getFailedOperations(Long applianceId, int limit); |
| 42 | + VnfFirewallRuleResponse createFirewallRule(CreateVnfFirewallRuleCmd cmd) throws CloudException; |
| 43 | + VnfFirewallRuleResponse updateVnfFirewallRule(UpdateVnfFirewallRuleCmd cmd) throws CloudException; |
| 44 | + boolean deleteVnfFirewallRule(DeleteVnfFirewallRuleCmd cmd) throws CloudException; |
| 45 | + |
| 46 | + // NAT Rule Operations |
| 47 | + VnfNATRuleResponse createVnfNATRule(CreateVnfNATRuleCmd cmd) throws CloudException; |
| 48 | + |
| 49 | + // Connectivity & Health |
| 50 | + VnfConnectivityResult testVnfConnectivity(TestVnfConnectivityCmd cmd) throws CloudException; |
| 51 | + |
| 52 | + // Network Reconciliation |
| 53 | + VnfReconciliationResult reconcileVnfNetwork(ReconcileVnfNetworkCmd cmd) throws CloudException; |
| 54 | + |
| 55 | + // Operation Tracking |
| 56 | + List<VnfOperationResponse> listAllOperations(ListVnfOperationsCmd cmd); |
| 57 | + List<org.apache.cloudstack.vnf.entity.VnfOperationVO> listOperationsByState(org.apache.cloudstack.vnf.entity.VnfOperationVO.State state); |
| 58 | + List<org.apache.cloudstack.vnf.entity.VnfOperationVO> listOperationsByVnfInstance(Long vnfInstanceId); |
| 59 | + List<org.apache.cloudstack.vnf.entity.VnfOperationVO> listOperationsByVnfInstanceAndState(Long vnfInstanceId, org.apache.cloudstack.vnf.entity.VnfOperationVO.State state); |
| 60 | + org.apache.cloudstack.vnf.entity.VnfOperationVO findOperationByRuleId(String ruleId); |
| 61 | + |
| 62 | + // VNF Instance Management |
| 63 | + VnfInstanceVO getVnfInstance(Long vnfInstanceId) throws CloudException; |
188 | 64 | } |
0 commit comments