diff options
Diffstat (limited to 'aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/L3InterfaceIpv4AddressListRequest.java')
-rw-r--r-- | aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/L3InterfaceIpv4AddressListRequest.java | 61 |
1 files changed, 39 insertions, 22 deletions
diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/L3InterfaceIpv4AddressListRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/L3InterfaceIpv4AddressListRequest.java index d9b2a91..364940a 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/L3InterfaceIpv4AddressListRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/L3InterfaceIpv4AddressListRequest.java @@ -31,7 +31,7 @@ import org.openecomp.sdnc.sli.aai.data.AAIDatum; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.L3InterfaceIpv4AddressList; +import org.openecomp.aai.inventory.v10.L3InterfaceIpv4AddressList; public class L3InterfaceIpv4AddressListRequest extends AAIRequest { @@ -63,13 +63,14 @@ public class L3InterfaceIpv4AddressListRequest extends AAIRequest { public static final String L3_INTERFACE_IPV4_ADDRESS_LIST_PATH = "org.openecomp.sdnc.sli.aai.path.l3.interface.ipv4.address.list"; public static final String VLAN_L3_INTERFACE_IPV4_ADDRESS_LIST_PATH = "org.openecomp.sdnc.sli.aai.path.vlan.l3.interface.ipv4.address.list"; - + private final String l3_interface_ipv4_address_list_path; private final String vlan_l3_interface_ipv4_address_list_path; - + public static final String L3_INTERFACE_IPV4_ADDRESS = "l3-interface-ipv4-address"; public static final String LIST_L3_INTERFACE_IPV4_ADDRESS = "l3-interface-ipv4-address-list.l3-interface-ipv4-address"; - + public static final String VLAN_INTERFACE = "vlan-interface"; + public static final String VLAN_VLAN_INTERFACE = "vlan.vlan-interface"; public L3InterfaceIpv4AddressListRequest() { l3_interface_ipv4_address_list_path = configProperties.getProperty(L3_INTERFACE_IPV4_ADDRESS_LIST_PATH); @@ -80,20 +81,20 @@ public class L3InterfaceIpv4AddressListRequest extends AAIRequest { public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { return this.getRequestUrl(method, null); } - + @Override public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { String request_url = target_uri+l3_interface_ipv4_address_list_path; - - if(requestProperties.containsKey(VLanRequest.VLAN_INTERFACE) || requestProperties.containsKey(VLanRequest.VLAN_VLAN_INTERFACE)){ + + if(requestProperties.containsKey(VLAN_INTERFACE) || requestProperties.containsKey(VLAN_VLAN_INTERFACE)){ request_url = target_uri+vlan_l3_interface_ipv4_address_list_path; - request_url = VLanRequest.processPathData(request_url, requestProperties); + request_url = processVLanRequestPathData(request_url, requestProperties); } request_url = processPathData(request_url, requestProperties); request_url = LInterfaceRequest.processPathData(request_url, requestProperties); - request_url = GenericVnfRequest.processPathData(request_url, requestProperties); +// request_url = GenericVnfRequest.processPathData(request_url, requestProperties); if(resourceVersion != null) { request_url = request_url +"?resource-version="+resourceVersion; @@ -101,10 +102,27 @@ public class L3InterfaceIpv4AddressListRequest extends AAIRequest { URL http_req_url = new URL(request_url); aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); - + return http_req_url; } + public static String processVLanRequestPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { + String key = null; + + if(requestProperties.containsKey(VLAN_VLAN_INTERFACE)) { + key = VLAN_VLAN_INTERFACE; + } else if(requestProperties.containsKey(VLAN_INTERFACE)) { + key = VLAN_INTERFACE; + } else { + aaiService.logKeyError(String.format("%s,%s", VLAN_INTERFACE, VLAN_VLAN_INTERFACE)); + } + + String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); + + request_url = request_url.replace("{vlan-interface}", encoded_vnf) ; + aaiService.LOGwriteDateTrace("vlan-interface", requestProperties.getProperty(key)); + return request_url; + } @Override public String toJSONString() { @@ -122,16 +140,15 @@ public class L3InterfaceIpv4AddressListRequest extends AAIRequest { @Override public String[] getArgsList() { - String[] args = + String[] args = { L3_INTERFACE_IPV4_ADDRESS, LIST_L3_INTERFACE_IPV4_ADDRESS, - VLanRequest.VLAN_INTERFACE, - VLanRequest.VLAN_VLAN_INTERFACE, - LInterfaceRequest.INTERFACE_NAME, + VLAN_INTERFACE, + VLAN_VLAN_INTERFACE, + LInterfaceRequest.INTERFACE_NAME, LInterfaceRequest.LINTERFACE_INTERFACE_NAME, - GenericVnfRequest.GENERIC_VNF_ID, - GenericVnfRequest.VNF_ID + "generic-vnf.vnf-id" }; return args; @@ -141,7 +158,7 @@ public class L3InterfaceIpv4AddressListRequest extends AAIRequest { public Class<? extends AAIDatum> getModelClass() { return L3InterfaceIpv4AddressList.class; } - + public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { String key = L3_INTERFACE_IPV4_ADDRESS; if(requestProperties.containsKey(LIST_L3_INTERFACE_IPV4_ADDRESS)) { @@ -151,29 +168,29 @@ public class L3InterfaceIpv4AddressListRequest extends AAIRequest { if(!requestProperties.containsKey(key)) { aaiService.logKeyError(String.format("%s,%s", L3_INTERFACE_IPV4_ADDRESS, LIST_L3_INTERFACE_IPV4_ADDRESS)); } - + String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{l3-interface-ipv4-address}", encoded_vnf) ; - + aaiService.LOGwriteDateTrace("l3-interface-ipv4-address", requestProperties.getProperty(key)); return request_url; } - + /* * (non-Javadoc) * @see org.openecomp.sdnc.sli.aai.PathConfigurator#configurePath(java.lang.String) */ // @Override // public void processRequestPathValues(Map<String, String> nameValues) { -// String[] paths = +// String[] paths = // { // "/aai/v7/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}", // "/aai/v7/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}", // "/aai/v7/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}", // "/aai/v7/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}" // }; -// +// // List<String>keys = new LinkedList<String>(); // keys.addAll(nameValues.keySet()); // for(String key : keys) { |