diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-07-30 15:56:09 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-07-31 11:09:25 -0400 |
commit | 5a6a6de6f1a26a1897e4917a0df613e25a24eb70 (patch) | |
tree | 59a968f27b4b603aacc9d5e7b51fb598aeec5321 /adapters/mso-adapters-rest-interface | |
parent | b6dc38501f3b746426b42d9de4cc883d894149e8 (diff) |
Containerization feature of SO
Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18
Issue-ID: SO-670
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-adapters-rest-interface')
150 files changed, 2685 insertions, 2365 deletions
diff --git a/adapters/mso-adapters-rest-interface/pom.xml b/adapters/mso-adapters-rest-interface/pom.xml index 00c6b7a986..7e341f0952 100644 --- a/adapters/mso-adapters-rest-interface/pom.xml +++ b/adapters/mso-adapters-rest-interface/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>adapters</artifactId> - <version>1.2.0-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <groupId>org.onap.so.adapters</groupId> <artifactId>mso-adapters-rest-interface</artifactId> @@ -23,9 +23,18 @@ <classesDirectory>target/classes</classesDirectory> </configuration> </plugin> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + </plugin> </plugins> </build> <dependencies> + <dependency> + <groupId>org.javatuples</groupId> + <artifactId>javatuples</artifactId> + <version>1.2</version> + </dependency> <dependency> <groupId>org.onap.so.libs.openstack-java-sdk</groupId> <artifactId>keystone-client</artifactId> @@ -51,6 +60,5 @@ <artifactId>common</artifactId> <version>${project.version}</version> </dependency> - </dependencies> </project> diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionTest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailPolicyRef.java index 58cea958df..f207c6185e 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionTest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailPolicyRef.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,11 +18,28 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.adapters.network.beans; -public class MsoOpenstackExceptionTest { - MsoOpenstackException msoOpenstackException= new MsoOpenstackException(404,"test","test"); - MsoOpenstackException msoOpenstackExceptionEx= new MsoOpenstackException(404,"test","test",new Exception()); - public String str = msoOpenstackException.toString(); +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ContrailPolicyRef { + + @JsonProperty("network_policy_refs_data_sequence") + private ContrailPolicyRefSeq seq; + + + public ContrailPolicyRefSeq getSeq() { + return seq; + } + + public void setSeq(ContrailPolicyRefSeq seq) { + this.seq = seq; + } + + public ContrailPolicyRef withRefSeq(ContrailPolicyRefSeq seq) { + this.seq = seq; + return this; + } + } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantTest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailPolicyRefSeq.java index 6e1f392c80..a3a5a710ed 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantTest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailPolicyRefSeq.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,44 +17,49 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; -import org.junit.Test; +package org.onap.so.adapters.network.beans; -import java.util.HashMap; -public class MsoTenantTest { +import com.fasterxml.jackson.annotation.JsonProperty; - MsoTenant msoTenant = new MsoTenant(); +public class ContrailPolicyRefSeq { + + @JsonProperty("network_policy_refs_data_sequence_major") + private String major; + + @JsonProperty("network_policy_refs_data_sequence_minor") + private String minor; - @Test - public void getTenantId() throws Exception { - msoTenant.getTenantId(); - } + public ContrailPolicyRefSeq() { + } + + public ContrailPolicyRefSeq(String major, String minor) { + super(); + this.major = major; + this.minor = minor; + } - @Test - public void setTenantId() throws Exception { - msoTenant.setTenantId("id-123"); - } + public String getMajor() { + return major; + } - @Test - public void getTenantName() throws Exception { - msoTenant.getTenantName(); - } + public void setMajor(String major) { + this.major = major; + } - @Test - public void setTenantName() throws Exception { - msoTenant.setTenantName("test"); - } + public String getMinor() { + return minor; + } - @Test - public void getMetadata() throws Exception { - msoTenant.getMetadata(); - } + public void setMinor(String minor) { + this.minor = minor; + } - @Test - public void setMetadata() throws Exception { - msoTenant.setMetadata(new HashMap<>()); - } + @Override + public String toString() { + return "ContrailPolicyRefSeq [major=" + major + ", minor=" + minor + + "]"; + } -}
\ No newline at end of file +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnet.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnet.java new file mode 100644 index 0000000000..fc674a0416 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnet.java @@ -0,0 +1,128 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.network.beans; + +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ContrailSubnet { + + @JsonProperty("network_ipam_refs_data_ipam_subnets_subnet") + private ContrailSubnetIp subnet = new ContrailSubnetIp(); + + @JsonProperty("network_ipam_refs_data_ipam_subnets_default_gateway") + private String defaultGateway; + + @JsonProperty("network_ipam_refs_data_ipam_subnets_subnet_name") + private String subnetName; + + @JsonProperty("network_ipam_refs_data_ipam_subnets_enable_dhcp") + private Boolean enableDhcp; + + @JsonProperty("network_ipam_refs_data_ipam_subnets_addr_from_start") + private Boolean addrFromStart = true; + /** future - leave this commented + private String subnet_uuid; + private String dns_server_address; + private List<String> dns_nameservers; + private String dhcp_option_list; + **/ + + @JsonProperty("network_ipam_refs_data_ipam_subnets_allocation_pools") + private List<ContrailSubnetPool> allocationPools = new ArrayList<>(); + + @JsonProperty("network_ipam_refs_data_ipam_subnets_host_routes") + private ContrailSubnetHostRoutes hostRoutes = new ContrailSubnetHostRoutes(); + + public ContrailSubnet() { + super(); + } + + public String getDefaultGateway() { + return defaultGateway; + } + + public void setDefaultGateway(String defaultGateway) { + this.defaultGateway = defaultGateway; + } + + public ContrailSubnetIp getSubnet() { + return subnet; + } + + public void setSubnet(ContrailSubnetIp subnet) { + this.subnet = subnet; + } + + public Boolean isEnableDhcp() { + return enableDhcp; + } + + public void setEnableDhcp(Boolean enableDhcp) { + this.enableDhcp = enableDhcp; + } + + public String getSubnetName() { + return subnetName; + } + + public void setSubnetName(String subnetName) { + this.subnetName = subnetName; + } + + public List<ContrailSubnetPool> getAllocationPools() { + return allocationPools; + } + + public void setAllocationPools(List<ContrailSubnetPool> allocationPools) { + this.allocationPools = allocationPools; + } + + public Boolean isAddrFromStart() { + return addrFromStart; + } + + public void setAddrFromStart(Boolean addrFromStart) { + this.addrFromStart = addrFromStart; + } + + public ContrailSubnetHostRoutes getHostRoutes() { + return hostRoutes; + } + + public void setHostRoutes(ContrailSubnetHostRoutes hostRoutes) { + this.hostRoutes = hostRoutes; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder (); + for (ContrailSubnetPool pool : allocationPools) + { + buf.append(pool.toString()); + } + return "ContrailSubnet [subnet=" + subnet.toString() + " default_gateway=" + defaultGateway + + " enable_dhcp=" + enableDhcp + " addr_from_start=" + addrFromStart + " subnet_name=" + subnetName + " allocation_pools=" + buf + " ]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetHostRoute.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetHostRoute.java new file mode 100644 index 0000000000..7d53715e3c --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetHostRoute.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.network.beans; + + +import com.fasterxml.jackson.annotation.JsonProperty; +public class ContrailSubnetHostRoute { + + @JsonProperty("network_ipam_refs_data_ipam_subnets_host_routes_route_prefix") + private String prefix; + + @JsonProperty("network_ipam_refs_data_ipam_subnets_host_routes_route_next_hop") + private String nextHop; + + public String getPrefix() { + return prefix; + } + + public void setPrefix(String prefix) { + this.prefix = prefix; + } + + public String getNextHop() { + return nextHop; + } + + public void setNextHop(String nextHop) { + this.nextHop = nextHop; + } + + @Override + public String toString() { + return "ContrailSubnetHostRoute [prefix=" + prefix + ", nextHop=" + nextHop + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetHostRoutes.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetHostRoutes.java new file mode 100644 index 0000000000..cd7192b6e2 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetHostRoutes.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.network.beans; + + +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +public class ContrailSubnetHostRoutes { + + @JsonProperty("network_ipam_refs_data_ipam_subnets_host_routes_route") + private List<ContrailSubnetHostRoute> hostRoutes = new ArrayList<>(); + + public List<ContrailSubnetHostRoute> getHostRoutes() { + return hostRoutes; + } + + public void setHostRoutes(List<ContrailSubnetHostRoute> hostRoutes) { + this.hostRoutes = hostRoutes; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder (); + if (hostRoutes != null) + { + for (ContrailSubnetHostRoute hr : hostRoutes) + { + buf.append(hr.toString()); + } + } + return "ContrailSubnetHostRoutes [" + buf.toString() + "]"; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/RouteTargetTest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetIp.java index fd34f48276..3986592dde 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/RouteTargetTest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetIp.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,32 +17,39 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; -import org.junit.Test; +package org.onap.so.adapters.network.beans; -public class RouteTargetTest { - RouteTarget routeTarget = new RouteTarget(); +import com.fasterxml.jackson.annotation.JsonProperty; - @Test - public void getRouteTarget() throws Exception { - routeTarget.getRouteTarget(); - } +public class ContrailSubnetIp { + + @JsonProperty("network_ipam_refs_data_ipam_subnets_subnet_ip_prefix") + private String ipPrefix; + + @JsonProperty("network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len") + private String ipPrefixLen; - @Test - public void setRouteTarget() throws Exception { - routeTarget.setRouteTarget("1.1.1.1"); - } + public String getIpPrefix() { + return ipPrefix; + } - @Test - public void getRouteTargetRole() throws Exception { - routeTarget.getRouteTargetRole(); - } + public void setIpPrefix(String ipPrefix) { + this.ipPrefix = ipPrefix; + } - @Test - public void setRole() throws Exception { - routeTarget.setRole("test"); - } + public String getIpPrefixLen() { + return ipPrefixLen; + } -}
\ No newline at end of file + public void setIpPrefixLen(String ipPrefixLen) { + this.ipPrefixLen = ipPrefixLen; + } + + @Override + public String toString() { + return "ContrailSubnetIp [ip_prefix=" + ipPrefix + ", ip_prefix_len=" + ipPrefixLen + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/HostRouteTest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetPool.java index 14f0485ba1..11a06c69d5 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/HostRouteTest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetPool.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,32 +17,39 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; -import org.junit.Test; +package org.onap.so.adapters.network.beans; -public class HostRouteTest { - HostRoute hostRoute = new HostRoute(); +import com.fasterxml.jackson.annotation.JsonProperty; - @Test - public void getPrefix() throws Exception { - hostRoute.getPrefix(); - } +public class ContrailSubnetPool { + + @JsonProperty("network_ipam_refs_data_ipam_subnets_allocation_pools_start") + private String start; + + @JsonProperty("network_ipam_refs_data_ipam_subnets_allocation_pools_end") + private String end; - @Test - public void setPrefix() throws Exception { - hostRoute.setPrefix("192.168.21/0"); - } + public String getStart() { + return start; + } - @Test - public void getNextHop() throws Exception { - hostRoute.setNextHop("127.0.0.1"); - } + public void setStart(String start) { + this.start = start; + } - @Test - public void setNextHop() throws Exception { - hostRoute.setNextHop("127.0.0.1"); - } + public String getEnd() { + return end; + } -}
\ No newline at end of file + public void setEnd(String end) { + this.end = end; + } + + @Override + public String toString() { + return "ContrailSubnetPool [start=" + start + ", end=" + end + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/PoolTest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetHostRouteMapper.java index 9795c18197..03800de5b8 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/PoolTest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetHostRouteMapper.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,32 +17,28 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; -import org.junit.Test; - -public class PoolTest { - - Pool pool = new Pool(); - - @Test - public void getStart() throws Exception { - pool.getStart(); - } - - @Test - public void setStart() throws Exception { - pool.setStart("test"); - } - - @Test - public void getEnd() throws Exception { - pool.getEnd(); - } - - @Test - public void setEnd() throws Exception { - pool.setEnd("test"); - } - -}
\ No newline at end of file +package org.onap.so.adapters.network.mappers; + +import org.onap.so.adapters.network.beans.ContrailSubnetHostRoute; +import org.onap.so.openstack.beans.HostRoute; + +public class ContrailSubnetHostRouteMapper { + + private final HostRoute hostRoute; + public ContrailSubnetHostRouteMapper(HostRoute hostRoute) { + this.hostRoute = hostRoute; + } + + public ContrailSubnetHostRoute map() { + + final ContrailSubnetHostRoute contrailSubnetHostRoute = new ContrailSubnetHostRoute(); + + if (hostRoute != null) { + contrailSubnetHostRoute.setNextHop(hostRoute.getNextHop()); + contrailSubnetHostRoute.setPrefix(hostRoute.getPrefix()); + } + return contrailSubnetHostRoute; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetMapper.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetMapper.java new file mode 100644 index 0000000000..d3ccb35a60 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetMapper.java @@ -0,0 +1,135 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.network.mappers; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.onap.so.adapters.network.beans.ContrailSubnet; +import org.onap.so.adapters.network.beans.ContrailSubnetHostRoute; +import org.onap.so.adapters.network.beans.ContrailSubnetHostRoutes; +import org.onap.so.adapters.network.beans.ContrailSubnetIp; +import org.onap.so.adapters.network.beans.ContrailSubnetPool; +import org.onap.so.openstack.beans.HostRoute; +import org.onap.so.openstack.beans.Pool; +import org.onap.so.openstack.beans.Subnet; + +public class ContrailSubnetMapper { + + private final Subnet inputSubnet; + public ContrailSubnetMapper(Subnet inputSubnet) { + this.inputSubnet = inputSubnet; + } + + public ContrailSubnet map() { + + final ContrailSubnet result = new ContrailSubnet(); + if (inputSubnet != null) { + final String subnetname = this.getSubnetName(inputSubnet); + result.setSubnetName(subnetname); + result.setEnableDhcp(inputSubnet.getEnableDHCP()); + result.setDefaultGateway(inputSubnet.getGatewayIp()); + + Optional<ContrailSubnetIp> csIp = createSubnet(inputSubnet); + if (csIp.isPresent()) { + result.setSubnet(csIp.get()); + } + Optional<List<ContrailSubnetPool>> pools = this.createContrailSubnetPool(inputSubnet); + if (pools.isPresent()) { + result.setAllocationPools(pools.get()); + } + Optional<ContrailSubnetHostRoutes> routes = this.createContrailSubnetHostRoutes(inputSubnet); + if (routes.isPresent()) { + result.setHostRoutes(routes.get()); + } + } + + return result; + } + + protected String getSubnetName(Subnet subnet) { + final String result; + if (!isNullOrEmpty(subnet.getSubnetName())) { + result = subnet.getSubnetName(); + } else { + result = subnet.getSubnetId(); + } + + return result; + } + + protected Optional<List<ContrailSubnetPool>> createContrailSubnetPool(final Subnet subnet) { + Optional<List<ContrailSubnetPool>> result = Optional.empty(); + if (subnet.getAllocationPools() != null) { + List<ContrailSubnetPool> pools = new ArrayList<>(); + for (Pool pool : subnet.getAllocationPools()) { + if ( !isNullOrEmpty(pool.getStart()) && !isNullOrEmpty(pool.getEnd()) ) { + + pools.add(new ContrailSubnetPoolMapper(pool).map()); + } + } + if (!pools.isEmpty()) { + result = Optional.of(pools); + } + } + + return result; + } + + protected Optional<ContrailSubnetHostRoutes> createContrailSubnetHostRoutes(final Subnet subnet) { + Optional<ContrailSubnetHostRoutes> result = Optional.empty(); + if (subnet.getHostRoutes() != null) { + ContrailSubnetHostRoutes hostRoutesObj = new ContrailSubnetHostRoutes(); + List<ContrailSubnetHostRoute> hrList = new ArrayList<>(); + for (HostRoute hr : subnet.getHostRoutes()) { + if ( !isNullOrEmpty(hr.getPrefix()) || !isNullOrEmpty(hr.getNextHop()) ) { + hrList.add(new ContrailSubnetHostRouteMapper(hr).map()); + } + } + if (!hrList.isEmpty()) { + hostRoutesObj.setHostRoutes(hrList); + result = Optional.of(hostRoutesObj); + } + } + + return result; + + } + protected Optional<ContrailSubnetIp> createSubnet(final Subnet subnet) { + Optional<ContrailSubnetIp> result = Optional.empty(); + if (!isNullOrEmpty(subnet.getCidr()) ) { + int idx = subnet.getCidr().indexOf("/"); + final ContrailSubnetIp csIp = new ContrailSubnetIp(); + if (idx != -1) { + csIp.setIpPrefix(subnet.getCidr().substring(0, idx)); + csIp.setIpPrefixLen(subnet.getCidr().substring(idx+1)); + result = Optional.of(csIp); + } + } + + return result; + } + + protected boolean isNullOrEmpty (String s) { + return s == null || s.isEmpty(); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetPoolMapper.java index cac02152e0..a492cd30c0 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundTest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetPoolMapper.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,11 +17,27 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; -public class MsoCloudSiteNotFoundTest { - MsoCloudSiteNotFound msoCloudSiteNotFound = new MsoCloudSiteNotFound(); - MsoCloudSiteNotFound msoCloudSiteNotFoundStr = new MsoCloudSiteNotFound("test"); - public String str = msoCloudSiteNotFoundStr.toString(); +package org.onap.so.adapters.network.mappers; +import org.onap.so.adapters.network.beans.ContrailSubnetPool; +import org.onap.so.openstack.beans.Pool; + +public class ContrailSubnetPoolMapper { + + private final Pool pool; + + public ContrailSubnetPoolMapper(Pool pool) { + this.pool = pool; + } + + public ContrailSubnetPool map() { + + ContrailSubnetPool result = new ContrailSubnetPool(); + if (pool != null) { + result.setStart(pool.getStart()); + result.setEnd(pool.getEnd()); + } + return result; + } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ContrailNetwork.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/ContrailNetwork.java index 60684a3599..9a7431130d 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ContrailNetwork.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/ContrailNetwork.java @@ -18,16 +18,24 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; +import java.io.Serializable; import java.util.List; -import org.openecomp.mso.openstack.beans.RouteTarget; + +import org.onap.so.openstack.beans.RouteTarget; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("contrailNetwork") -public class ContrailNetwork { +public class ContrailNetwork implements Serializable{ + + + /** + * + */ + private static final long serialVersionUID = 6879356795950005963L; private String shared = "false"; private String external = "false"; private List<RouteTarget> routeTargets; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkError.java index 4b105cce92..fec9b474dd 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkError.java @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; +import org.onap.so.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "createNetworkError") public class CreateNetworkError extends NetworkExceptionResponse implements Serializable { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java index 4c2cc36c83..3e4d18cb1b 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; @@ -28,8 +28,8 @@ import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.entity.MsoRequest; -import org.openecomp.mso.openstack.beans.Subnet; +import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.beans.Subnet; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -37,12 +37,16 @@ import com.fasterxml.jackson.annotation.JsonRootName; /* README - Map<String, String> elements when marshalled to XML produce a list of <entry><key>${key}</key><value>${value}</value></entry> elements. + Map<String, String> elements when marshalled to XML produce a list of <entry><key>${MsoUtils.xmlEscape(key)}</key><value>${MsoUtils.xmlEscape(value)}</value></entry> elements. When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. */ @JsonRootName("createNetworkRequest") @XmlRootElement(name = "createNetworkRequest") public class CreateNetworkRequest extends NetworkRequestCommon { + /** + * + */ + private static final long serialVersionUID = -8984362978831333521L; private String cloudSiteId; private String tenantId; private String networkId; @@ -121,12 +125,13 @@ public class CreateNetworkRequest extends NetworkRequestCommon { this.networkTypeVersion = networkTypeVersion; } - public String getNetworkTechnology() { - return networkTechnology.toString(); + public NetworkTechnology getNetworkTechnology() { + return networkTechnology; } - public void setNetworkTechnology(String networkTechnology) { - this.networkTechnology = NetworkTechnology.valueOf(networkTechnology); + public void setNetworkTechnology(NetworkTechnology networkTechnology) { + this.networkTechnology = networkTechnology; + this.contrailRequest = determineContrail(); } public List<Subnet> getSubnets() { @@ -151,6 +156,7 @@ public class CreateNetworkRequest extends NetworkRequestCommon { public void setContrailNetwork(ContrailNetwork contrailNetwork) { this.contrailNetwork = contrailNetwork; + this.contrailRequest = determineContrail(); } public Boolean getFailIfExists() { @@ -186,11 +192,15 @@ public class CreateNetworkRequest extends NetworkRequestCommon { } public boolean isContrailRequest() { - return (networkTechnology == NetworkTechnology.CONTRAIL) && (contrailNetwork != null); + return this.contrailRequest; } @JsonIgnore - public void setContrailRequest(boolean contrailRequest) { + protected void setContrailRequest(boolean contrailRequest) { this.contrailRequest = contrailRequest; } + + private boolean determineContrail() { + return (networkTechnology == NetworkTechnology.CONTRAIL && (contrailNetwork != null)); + } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkResponse.java index 6db7661905..763732213d 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkResponse.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; @@ -26,7 +26,7 @@ import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.openstack.beans.NetworkRollback; +import org.onap.so.openstack.beans.NetworkRollback; import com.fasterxml.jackson.annotation.JsonRootName; @@ -34,6 +34,11 @@ import com.fasterxml.jackson.annotation.JsonRootName; @XmlRootElement(name = "createNetworkResponse") public class CreateNetworkResponse extends NetworkResponseCommon { + /** + * + */ + private static final long serialVersionUID = -7730406297031948309L; + private String networkId; private String neutronNetworkId; private String networkStackId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkError.java index 6a5e354f87..f874be56a3 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkError.java @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; +import org.onap.so.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "deleteNetworkError") public class DeleteNetworkError extends NetworkExceptionResponse implements Serializable { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkRequest.java index d899ac921e..f069bf2ed2 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkRequest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,13 +18,13 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.entity.MsoRequest; +import org.onap.so.entity.MsoRequest; import com.fasterxml.jackson.annotation.JsonRootName; @@ -33,6 +33,10 @@ import com.fasterxml.jackson.annotation.JsonRootName; @XmlRootElement(name = "deleteNetworkRequest") public class DeleteNetworkRequest extends NetworkRequestCommon { + /** + * + */ + private static final long serialVersionUID = -2445072708572065058L; private String cloudSiteId; private String tenantId; private String networkId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkResponse.java index ee62751edb..1de7f8be76 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkResponse.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; @@ -30,6 +30,10 @@ import com.fasterxml.jackson.annotation.JsonRootName; @XmlRootElement(name = "deleteNetworkResponse") public class DeleteNetworkResponse extends NetworkResponseCommon { + /** + * + */ + private static final long serialVersionUID = 68336086339501537L; private String networkId; private Boolean networkDeleted; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkExceptionResponse.java index 195d6da176..4b9f283e20 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkExceptionResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkExceptionResponse.java @@ -18,14 +18,18 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; +import org.onap.so.openstack.exceptions.MsoExceptionCategory; public class NetworkExceptionResponse extends NetworkResponseCommon { - private String message; + /** + * + */ + private static final long serialVersionUID = -7160401922983004097L; + private String message; private MsoExceptionCategory category; private Boolean rolledBack; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkRequestCommon.java index 56fc19870c..3d66da3a2d 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkRequestCommon.java @@ -19,32 +19,34 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; import java.io.ByteArrayOutputStream; +import java.io.Serializable; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.logger.MsoLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; /** * Everything that is common between all Network Requests. */ -public abstract class NetworkRequestCommon { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); +public abstract class NetworkRequestCommon implements Serializable { + private static final long serialVersionUID = -6732431343649282079L; + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, NetworkRequestCommon.class); private Boolean skipAAI = false; private String messageId; private String notificationUrl; @JsonProperty - private boolean synchronous; + private boolean synchronous = true; public Boolean getSkipAAI() { return skipAAI; } @@ -67,14 +69,15 @@ public abstract class NetworkRequestCommon { public void setNotificationUrl(String notificationUrl) { this.notificationUrl = notificationUrl; + this.synchronous = notificationUrl == null || (notificationUrl.isEmpty()); } public boolean isSynchronous() { - return notificationUrl == null || (notificationUrl.isEmpty()); + return this.synchronous; } @JsonIgnore - public void setSynchronous(boolean synchronous) { + protected void setSynchronous(boolean synchronous) { this.synchronous = synchronous; } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkResponseCommon.java index f92f4ea769..d626f26aa6 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkResponseCommon.java @@ -19,24 +19,28 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; import java.io.ByteArrayOutputStream; +import java.io.Serializable; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; +import org.onap.so.logger.MsoLogger; + import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; -import org.openecomp.mso.logger.MsoLogger; /** * Everything that is common between all Volume Group Responses, except for QueryVolumeGroupResponse. */ -public abstract class NetworkResponseCommon { +public abstract class NetworkResponseCommon implements Serializable { + + private static final long serialVersionUID = 1233520856935129726L; private String messageId; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, NetworkResponseCommon.class); public NetworkResponseCommon() { messageId = null; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkTechnology.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkTechnology.java index 83eddbc33d..cade9b44c8 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkTechnology.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkTechnology.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; public enum NetworkTechnology { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ProviderVlanNetwork.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/ProviderVlanNetwork.java index 7525da9049..fbd21b8197 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ProviderVlanNetwork.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/ProviderVlanNetwork.java @@ -18,13 +18,18 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; +import java.io.Serializable; import java.util.List; -public class ProviderVlanNetwork { +public class ProviderVlanNetwork implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 6744949861614446315L; private String physicalNetworkName; private List<Integer> vlans; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkError.java index 5ff64a47a2..6e8ace9cf0 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkError.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; import java.io.Serializable; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkResponse.java index 7df5472607..6953dfe7e5 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkResponse.java @@ -19,19 +19,23 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.beans.NetworkStatus; -import org.openecomp.mso.openstack.beans.RouteTarget; +import org.onap.so.logger.MsoLogger; +import org.onap.so.openstack.beans.NetworkStatus; +import org.onap.so.openstack.beans.RouteTarget; @XmlRootElement(name = "queryNetworkResponse") public class QueryNetworkResponse extends NetworkResponseCommon { + /** + * + */ + private static final long serialVersionUID = -5251191073081795026L; private String networkId; private String neutronNetworkId; private String networkStackId; @@ -41,7 +45,7 @@ public class QueryNetworkResponse extends NetworkResponseCommon { private List<RouteTarget> routeTargets; private Map<String, String> subnetIdMap; private Map<String, String> networkOutputs; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, QueryNetworkResponse.class); public QueryNetworkResponse() { super(); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkError.java index 67a4b906c7..cb148dfcef 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkError.java @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; +import org.onap.so.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "rollbackNetworkError") public class RollbackNetworkError extends NetworkExceptionResponse implements Serializable { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkRequest.java index 03b4123d06..494d3123d1 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkRequest.java @@ -18,18 +18,23 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; import javax.xml.bind.annotation.XmlRootElement; +import org.onap.so.openstack.beans.NetworkRollback; + import com.fasterxml.jackson.annotation.JsonRootName; -import org.openecomp.mso.openstack.beans.NetworkRollback; @JsonRootName("rollbackNetworkRequest") @XmlRootElement(name = "rollbackNetworkRequest") public class RollbackNetworkRequest extends NetworkRequestCommon { + /** + * + */ + private static final long serialVersionUID = -8705660877263749940L; private NetworkRollback networkRollback; public RollbackNetworkRequest() { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkResponse.java index f7b80bd63e..9be8bb3a69 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkResponse.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; @@ -31,6 +31,10 @@ import com.fasterxml.jackson.annotation.JsonRootName; @XmlRootElement(name = "rollbackNetworkResponse") public class RollbackNetworkResponse extends NetworkResponseCommon { + /** + * + */ + private static final long serialVersionUID = 3115905123337163846L; private Boolean networkRolledBack; public RollbackNetworkResponse() { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkError.java index 3385167f60..642ac4cc64 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkError.java @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; +import org.onap.so.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "updateNetworkError") public class UpdateNetworkError extends NetworkExceptionResponse implements Serializable { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkRequest.java index 7b3236efa5..c1c8258a6a 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkRequest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; @@ -28,9 +28,9 @@ import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.entity.MsoRequest; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.beans.Subnet; +import org.onap.so.entity.MsoRequest; +import org.onap.so.logger.MsoLogger; +import org.onap.so.openstack.beans.Subnet; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -39,6 +39,10 @@ import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("updateNetworkRequest") @XmlRootElement(name = "updateNetworkRequest") public class UpdateNetworkRequest extends NetworkRequestCommon { + /** + * + */ + private static final long serialVersionUID = -1219693235726357143L; private String cloudSiteId; private String tenantId; private String networkId; @@ -54,7 +58,7 @@ public class UpdateNetworkRequest extends NetworkRequestCommon { private Boolean backout = true; private Map<String,String> networkParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, UpdateNetworkRequest.class); @JsonProperty private boolean contrailRequest; public UpdateNetworkRequest() { @@ -125,16 +129,13 @@ public class UpdateNetworkRequest extends NetworkRequestCommon { this.networkTypeVersion = networkTypeVersion; } - public String getNetworkTechnology() { - return networkTechnology.toString(); + public NetworkTechnology getNetworkTechnology() { + return networkTechnology; } - public void setNetworkTechnology(String networkTechnology) { - try { - this.networkTechnology = NetworkTechnology.valueOf(networkTechnology.toUpperCase()); - } catch (IllegalArgumentException e) { - LOGGER.debug("Exception:", e); - } + public void setNetworkTechnology(NetworkTechnology networkTechnology) { + this.networkTechnology = networkTechnology; + this.contrailRequest = determineContrail(); } public List<Subnet> getSubnets() { @@ -159,6 +160,7 @@ public class UpdateNetworkRequest extends NetworkRequestCommon { public void setContrailNetwork(ContrailNetwork contrailNetwork) { this.contrailNetwork = contrailNetwork; + this.contrailRequest = determineContrail(); } public Boolean getBackout() { @@ -184,13 +186,16 @@ public class UpdateNetworkRequest extends NetworkRequestCommon { public void setMsoRequest(MsoRequest msoRequest) { this.msoRequest = msoRequest; } - + @JsonIgnore + protected void setContrailRequest(boolean contrailRequest) { + this.contrailRequest = contrailRequest; + } public boolean isContrailRequest() { - return (networkTechnology == NetworkTechnology.CONTRAIL) && (contrailNetwork != null); + return contrailRequest; } - @JsonIgnore - public void setContrailRequest() { - this.contrailRequest = contrailRequest; + private boolean determineContrail() { + return (networkTechnology == NetworkTechnology.CONTRAIL && (contrailNetwork != null)); } + } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkResponse.java index 3ca6824a49..7ce66ba58e 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkResponse.java @@ -18,20 +18,24 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.nwrest; +package org.onap.so.adapters.nwrest; import java.util.Map; + import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; + import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("updateNetworkResponse") @XmlRootElement(name = "updateNetworkResponse") -@NoJackson public class UpdateNetworkResponse extends NetworkResponseCommon { + /** + * + */ + private static final long serialVersionUID = -7528214382414366136L; private String networkId; private String neutronNetworkId; private Map<String, String> subnetMap; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/RequestInformation.java index 3dc81fbdda..ae7ff27bed 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/RequestInformation.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,13 +17,15 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.sdncrest; -import com.fasterxml.jackson.annotation.JsonProperty; +package org.onap.so.adapters.sdncrest; -import javax.xml.bind.annotation.XmlElement; import java.io.Serializable; +import javax.xml.bind.annotation.XmlElement; + +import com.fasterxml.jackson.annotation.JsonProperty; + /** * Request Information specified by the SDNC "agnostic" API. */ @@ -49,6 +51,14 @@ public class RequestInformation implements Serializable { // Identifies the request sub action private String requestSubAction; + @JsonProperty("orderNumber") + @XmlElement(name = "orderNumber") + private String orderNumber; + + @JsonProperty("orderVersion") + @XmlElement(name = "orderVersion") + private String orderVersion; + public RequestInformation(String requestId, String source, String notificationUrl) { this.requestId = requestId; this.source = source; @@ -112,4 +122,22 @@ public class RequestInformation implements Serializable { public void setRequestSubAction(String requestSubAction) { this.requestSubAction = requestSubAction; } + + public String getOrderNumber() { + return orderNumber; + } + + public void setOrderNumber(String orderNumber) { + this.orderNumber = orderNumber; + } + + public String getOrderVersion() { + return orderVersion; + } + + public void setOrderVersion(String orderVersion) { + this.orderVersion = orderVersion; + } + + }
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCErrorCommon.java index 280703a534..b6cd6a1eed 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCErrorCommon.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,8 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.sdncrest; + +package org.onap.so.adapters.sdncrest; import java.io.Serializable; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCEvent.java index 3dbeaef17f..7d6aebdf16 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCEvent.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,8 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.sdncrest; + +package org.onap.so.adapters.sdncrest; import java.io.IOException; import java.io.Serializable; @@ -28,7 +29,7 @@ import java.util.Map; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.logger.MsoLogger; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -42,7 +43,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; // is also required in this environment. /** - Map<String, String> elements when marshalled to XML produce a list of <entry><key>${key}</key><value>${value}</value></entry> elements. + Map<String, String> elements when marshalled to XML produce a list of <entry><key>${MsoUtils.xmlEscape(key)}</key><value>${MsoUtils.xmlEscape(value)}</value></entry> elements. When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. * </pre> */ @@ -52,7 +53,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; public class SDNCEvent implements Serializable { private static final long serialVersionUID = 1L; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, SDNCEvent.class); // Event type private String eventType; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCRequestCommon.java index e1ee9894e2..9ddf55cc21 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCRequestCommon.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,14 +17,15 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.sdncrest; + +package org.onap.so.adapters.sdncrest; import java.io.IOException; import java.io.Serializable; import javax.xml.bind.annotation.XmlElement; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.logger.MsoLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -38,7 +39,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; public abstract class SDNCRequestCommon implements Serializable { private static final long serialVersionUID = 1L; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, SDNCRequestCommon.class); // Endpoint on which BPMN can receive notifications from the SDNC adapter. private String bpNotificationUrl; @@ -85,12 +86,12 @@ public abstract class SDNCRequestCommon implements Serializable { @JsonProperty("sdncRequestId") @XmlElement(name = "sdncRequestId") - public String getSDNCRequestId() { + public String getSdncRequestId() { return sdncRequestId; } @JsonProperty("sdncRequestId") - public void setSDNCRequestId(String sdncRequestId) { + public void setSdncRequestId(String sdncRequestId) { this.sdncRequestId = sdncRequestId; } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCResponseCommon.java index 7265d67923..2da94017ca 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCResponseCommon.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,14 +18,15 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.sdncrest; + +package org.onap.so.adapters.sdncrest; import java.io.IOException; import java.io.Serializable; import javax.xml.bind.annotation.XmlElement; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.logger.MsoLogger; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; @@ -38,7 +39,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; public abstract class SDNCResponseCommon implements Serializable { private static final long serialVersionUID = 1L; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, SDNCResponseCommon.class); // Identifies the MSO transaction with SDNC. private String sdncRequestId; @@ -66,12 +67,12 @@ public abstract class SDNCResponseCommon implements Serializable { @JsonProperty("sdncRequestId") @XmlElement(name = "sdncRequestId") - public String getSDNCRequestId() { + public String getSdncRequestId() { return sdncRequestId; } @JsonProperty("sdncRequestId") - public void setSDNCRequestId(String sdncRequestId) { + public void setSdncRequestId(String sdncRequestId) { this.sdncRequestId = sdncRequestId; } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceError.java index 8d693e932a..fdb735891c 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceError.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,8 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.sdncrest; + +package org.onap.so.adapters.sdncrest; import java.io.Serializable; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java index a21585764f..b271af2f9b 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,10 +17,14 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.sdncrest; + +package org.onap.so.adapters.sdncrest; import java.io.Serializable; +import javax.ws.rs.Consumes; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @@ -59,7 +63,7 @@ public class SDNCServiceRequest extends SDNCRequestCommon implements Serializabl private String sdncServiceDataType; // The SDNC service data specified by SDNC "agnostic" API - private String sndcServiceData; + private String sdncServiceData; public SDNCServiceRequest() { } @@ -75,7 +79,7 @@ public class SDNCServiceRequest extends SDNCRequestCommon implements Serializabl this.sdncService = sdncService; this.sdncOperation = sdncOperation; this.sdncServiceDataType = sdncServiceDataType; - this.sndcServiceData = sndcServiceData; + this.sdncServiceData = sndcServiceData; } @JsonProperty("requestInformation") @@ -102,45 +106,45 @@ public class SDNCServiceRequest extends SDNCRequestCommon implements Serializabl @JsonProperty("sdncService") @XmlElement(name = "sdncService") - public String getSDNCService() { + public String getSdncService() { return sdncService; } @JsonProperty("sdncService") - public void setSDNCService(String sdncService) { + public void setSdncService(String sdncService) { this.sdncService = sdncService; } @JsonProperty("sdncOperation") @XmlElement(name = "sdncOperation") - public String getSDNCOperation() { + public String getSdncOperation() { return sdncOperation; } @JsonProperty("sdncOperation") - public void setSDNCOperation(String sdncOperation) { + public void setSdncOperation(String sdncOperation) { this.sdncOperation = sdncOperation; } @JsonProperty("sdncServiceDataType") @XmlElement(name = "sdncServiceDataType") - public String getSDNCServiceDataType() { + public String getSdncServiceDataType() { return sdncServiceDataType; } @JsonProperty("sdncServiceDataType") - public void setSDNCServiceDataType(String sdncServiceDataType) { + public void setSdncServiceDataType(String sdncServiceDataType) { this.sdncServiceDataType = sdncServiceDataType; } @JsonProperty("sdncServiceData") @XmlElement(name = "sdncServiceData") - public String getSDNCServiceData() { - return sndcServiceData; + public String getSdncServiceData() { + return sdncServiceData; } @JsonProperty("sdncServiceData") - public void setSDNCServiceData(String sndcServiceData) { - this.sndcServiceData = sndcServiceData; + public void setSdncServiceData(String sndcServiceData) { + this.sdncServiceData = sndcServiceData; } }
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceResponse.java index c74fb08972..18c9d49939 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceResponse.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,8 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.sdncrest; + +package org.onap.so.adapters.sdncrest; import java.io.Serializable; import java.util.LinkedHashMap; @@ -36,7 +37,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; // is also required in this environment. /** - Map<String, String> elements when marshalled to XML produce a list of <entry><key>${key}</key><value>${value}</value></entry> elements. + Map<String, String> elements when marshalled to XML produce a list of <entry><key>${MsoUtils.xmlEscape(key)}</key><value>${MsoUtils.xmlEscape(value)}</value></entry> elements. When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. * </pre> */ diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/ServiceInformation.java index 1cdea6518a..b4fe26ac00 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/ServiceInformation.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,13 +17,15 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.sdncrest; -import com.fasterxml.jackson.annotation.JsonProperty; +package org.onap.so.adapters.sdncrest; -import javax.xml.bind.annotation.XmlElement; import java.io.Serializable; +import javax.xml.bind.annotation.XmlElement; + +import com.fasterxml.jackson.annotation.JsonProperty; + /** * Service Information specified by the SDNC "agnostic" API. */ diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantError.java index 38fb4ac3f8..34da8c6292 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantError.java @@ -18,13 +18,15 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.tenantrest; +package org.onap.so.adapters.tenantrest; import java.io.Serializable; + import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "createTenantError") public class CreateTenantError implements Serializable { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantRequest.java index 227e58338d..d52e714f70 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantRequest.java @@ -18,15 +18,17 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.tenantrest; +package org.onap.so.adapters.tenantrest; -import org.openecomp.mso.entity.MsoRequest; -import java.util.Map; import java.util.HashMap; +import java.util.Map; + import javax.xml.bind.annotation.XmlRootElement; +import org.onap.so.entity.MsoRequest; + @XmlRootElement(name = "createTenantRequest") public class CreateTenantRequest extends TenantRequestCommon { private String cloudSiteId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantResponse.java index f091a22bcb..ec304cec41 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantResponse.java @@ -18,11 +18,12 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.tenantrest; +package org.onap.so.adapters.tenantrest; import java.io.Serializable; + import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "createTenantResponse") diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantError.java index 17af950f3f..d2c22e8506 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantError.java @@ -18,13 +18,15 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.tenantrest; +package org.onap.so.adapters.tenantrest; import java.io.Serializable; + import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "deleteTenantError") public class DeleteTenantError implements Serializable { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantRequest.java index 47761ce086..a39b7164e2 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantRequest.java @@ -18,13 +18,14 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.tenantrest; +package org.onap.so.adapters.tenantrest; -import org.openecomp.mso.entity.MsoRequest; import javax.xml.bind.annotation.XmlRootElement; +import org.onap.so.entity.MsoRequest; + @XmlRootElement(name = "deleteTenantRequest") public class DeleteTenantRequest extends TenantRequestCommon { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantResponse.java index 9c18734a17..e7961d4607 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantResponse.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.tenantrest; +package org.onap.so.adapters.tenantrest; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/QueryTenantError.java index 1347f78fbe..10f4b70a07 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/QueryTenantError.java @@ -18,13 +18,15 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.tenantrest; +package org.onap.so.adapters.tenantrest; import java.io.Serializable; + import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "queryTenantError") public class QueryTenantError implements Serializable { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/QueryTenantResponse.java index 4d667b6a0e..8d478cd393 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/QueryTenantResponse.java @@ -18,11 +18,12 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.tenantrest; +package org.onap.so.adapters.tenantrest; import java.util.Map; + import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "queryTenantResponse") diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantError.java index af76d689fe..725b40549d 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantError.java @@ -18,13 +18,15 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.tenantrest; +package org.onap.so.adapters.tenantrest; import java.io.Serializable; + import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "rollbackTenantError") public class RollbackTenantError implements Serializable { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantRequest.java index 7a67ffeaaa..d99150fc47 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantRequest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.tenantrest; +package org.onap.so.adapters.tenantrest; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantResponse.java index da329b8a29..25b77b3490 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantResponse.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.tenantrest; +package org.onap.so.adapters.tenantrest; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantExceptionResponse.java index 930f46271b..f4dd7f9499 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantExceptionResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantExceptionResponse.java @@ -18,12 +18,16 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.tenantrest; +package org.onap.so.adapters.tenantrest; + + -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; import java.io.Serializable; + import javax.xml.bind.annotation.XmlRootElement; +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + @XmlRootElement(name = "createTenantResponse") public class TenantExceptionResponse implements Serializable { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantRequestCommon.java index b00b98ef3e..168200e477 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRequestCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantRequestCommon.java @@ -19,21 +19,24 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.tenantrest; +package org.onap.so.adapters.tenantrest; import java.io.ByteArrayOutputStream; +import java.io.Serializable; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; +import org.onap.so.logger.MsoLogger; + import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; -import org.openecomp.mso.logger.MsoLogger; +public abstract class TenantRequestCommon implements Serializable { -public class TenantRequestCommon { - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private static final long serialVersionUID = 1486834308868170854L; + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, TenantRequestCommon.class); public String toJsonString() { try { String jsonString; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantRollback.java index 27aab8d3ff..195628167e 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRollback.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantRollback.java @@ -18,13 +18,13 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.tenantrest; +package org.onap.so.adapters.tenantrest; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.entity.MsoRequest; +import org.onap.so.entity.MsoRequest; /** * Javabean representing the rollback criteria following a "Create Tenant" @@ -36,6 +36,7 @@ import org.openecomp.mso.entity.MsoRequest; @XmlRootElement(name = "rollbackTenantRequest") public class TenantRollback extends TenantRequestCommon { + private static final long serialVersionUID = -4540810517355635993L; private String tenantId; private String cloudId; private boolean tenantCreated = false; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java new file mode 100644 index 0000000000..a56a6929a9 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vdu; + +/** + * Cloud information structure for deploying/managing a VDU. Includes the cloud site + * as well as tenant information within the site. Currently this is defined as a + * cloud site ID. which would map to a CloudConfig entry. + * Perhaps the CloudConfig entry itself should be provided, instead of requiring each + * plug-in to query it. + * + * The meaning of 'tenant' may differ by cloud provider, but every cloud supports some + * sort of tenant partitioning. + * + */ +public class CloudInfo { + + private String cloudSiteId; + private String tenantId; + private String tenantName;//bpmn query and pass + + public CloudInfo() { + } + + public CloudInfo (String cloudSiteId, String tenantId, String tenantName) { + this.cloudSiteId = cloudSiteId; + this.tenantId = tenantId; + this.tenantName = tenantName; + } + + public String getCloudSiteId() { + return cloudSiteId; + } + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getTenantName() { + return tenantName; + } + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + + +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/PluginAction.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/PluginAction.java new file mode 100644 index 0000000000..1f097ddd68 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/PluginAction.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vdu; + +/** + * Java beam representing a detailed action performed within a plugin during VDU + * orchestration. This allows the plugin to convey more detailed information about + * recent activities it has performed. It is primarily intended for logging and + * troubleshooting, so plugins are free to populate this as desired. + */ +public class PluginAction { + + private String action; + private String status; + private String rawMessage; + + public PluginAction () { + } + + public PluginAction (String action, String status, String rawMessage) { + this.action = action; + this.status = status; + this.rawMessage = rawMessage; + } + + public String getAction() { + return action; + } + public void setAction(String action) { + this.action = action; + } + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + public String getRawMessage() { + return rawMessage; + } + public void setRawMessage(String rawMessage) { + this.rawMessage = rawMessage; + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java new file mode 100644 index 0000000000..a53cd0ce49 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vdu; + +import java.util.Arrays; +import java.util.Objects; + +public class VduArtifact { + + // Enumerate the types of artifacts permitted. This may need to be a variable string + // value if arbitrary (cloud-specific) artifacts may be attached to VDUs in ASDC. + public enum ArtifactType { + MAIN_TEMPLATE, NESTED_TEMPLATE, CONFIG_FILE, SCRIPT_FILE, TEXT_FILE, ENVIRONMENT + } + + private String name; + private byte[] content; + private ArtifactType type; + + // Default constructor + public VduArtifact() {} + + // Fully specified constructor + public VduArtifact (String name, byte[] content, ArtifactType type) { + this.name = name; + this.content = content; + this.type = type; + } + + public String getName() { + return name; + } + public void setName (String name) { + this.name = name; + } + public byte[] getContent() { + return content; + } + public void setContent(byte[] content) { + this.content = content; + } + public ArtifactType getType() { + return type; + } + public void setType(ArtifactType type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VduArtifact that = (VduArtifact) o; + return Objects.equals(name, that.name) && + Arrays.equals(content, that.content) && + type == that.type; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduException.java new file mode 100644 index 0000000000..c611b87e5c --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduException.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vdu; + +import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +/** + * OpenStack exception. + */ +public class VduException extends MsoException +{ + + /** + * Serialization id. + */ + private static final long serialVersionUID = 3313636124141766495L; + + /** + * Constructor to create a new VduException instance + * @param detail error details + */ + public VduException (String detail) { + // Set the detailed error as the Exception 'message' + super(detail); + // TODO: Need a more generic category than OPENSTACK + super.category = MsoExceptionCategory.OPENSTACK; + } + + /** + * Constructor to create a new VduException instance + * @param detail error details + * @param e the cause + */ + public VduException (String detail, Exception e) { + // Set the detailed error as the Exception 'message' + super(detail, e); + // TODO: Need a more generic category than OPENSTACK + super.category = MsoExceptionCategory.OPENSTACK; + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduInstance.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduInstance.java new file mode 100644 index 0000000000..8f5f0f9745 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduInstance.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vdu; + +import java.util.Map; +import java.util.HashMap; + +/* + * This Java bean class relays VDU status information in a cloud-agnostic format. + * + * This bean is returned by all implementors of the VduPlugin interface operations + * (instantiate, query, delete). + */ + +public class VduInstance { + // Set defaults for everything + protected String vduInstanceId; + protected String vduInstanceName; + protected VduStatus status; + protected Map<String, Object> outputs = new HashMap<>(); + protected Map<String, Object> inputs = new HashMap<>(); + + public String getVduInstanceId() { + return vduInstanceId; + } + + public void setVduInstanceId(String vduInstanceId) { + this.vduInstanceId = vduInstanceId; + } + + public String getVduInstanceName() { + return vduInstanceName; + } + + public void setVduInstanceName(String vduInstanceName) { + this.vduInstanceName = vduInstanceName; + } + + public VduStatus getStatus() { + return status; + } + + public void setStatus(VduStatus status) { + this.status = status; + } + + public Map<String, Object> getOutputs() { + return outputs; + } + + public void setOutputs(Map<String, Object> outputs) { + this.outputs = outputs; + } + + public Map<String, Object> getInputs() { + return inputs; + } + + public void setInputs(Map<String, Object> inputs) { + this.inputs = inputs; + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduModelInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduModelInfo.java new file mode 100644 index 0000000000..47f4c74aae --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduModelInfo.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vdu; + +import java.util.ArrayList; +import java.util.List; + +public class VduModelInfo { + private String modelCustomizationUUID; + private int timeoutMinutes; + private List<VduArtifact> artifacts = new ArrayList<>(); + + public String getModelCustomizationUUID() { + return modelCustomizationUUID; + } + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + public int getTimeoutMinutes() { + return timeoutMinutes; + } + public void setTimeoutMinutes(int timeoutMinutes) { + this.timeoutMinutes = timeoutMinutes; + } + public List<VduArtifact> getArtifacts() { + return artifacts; + } + public void setArtifacts(List<VduArtifact> artifacts) { + this.artifacts = artifacts; + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionTest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java index 738fe9e4d9..0b95b392f6 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionTest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java @@ -1,15 +1,15 @@ /*- * ============LICENSE_START======================================================= - * ONAP - SO + * OPENECOMP - MSO * ================================================================================ - * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,9 +18,19 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.adapters.vdu; -public class MsoAdapterExceptionTest { - MsoAdapterException msoAdapterException = new MsoAdapterException("test"); - MsoAdapterException msoAdapterExceptionThr = new MsoAdapterException("test" , new Throwable()); + +/* + * Enum status values to capture the state of a generic (cloud-agnostic) VDU. + */ +public enum VduStateType { + NOTFOUND, + INSTANTIATING, + INSTANTIATED, + DELETING, + DELETED, // Note - only returned in success response to deleteVdu call. + UPDATING, + FAILED, + UNKNOWN } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStatus.java new file mode 100644 index 0000000000..7797c997a5 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStatus.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vdu; + +public class VduStatus { + + private VduStateType state; + private String errorMessage; + private PluginAction lastAction; + + public VduStatus(){} + public VduStatus( VduStateType state) { + this.state = state; + } + public VduStateType getState() { + return state; + } + public void setState(VduStateType state) { + this.state = state; + } + public String getErrorMessage() { + return errorMessage; + } + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + public PluginAction getLastAction() { + return lastAction; + } + public void setLastAction(PluginAction lastAction) { + this.lastAction = lastAction; + } + public void setLastAction (String action, String status, String rawCloudMessage) { + lastAction = new PluginAction(); + lastAction.setAction (action); + lastAction.setStatus (status); + lastAction.setRawMessage(rawCloudMessage); + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java index dac09d4cd1..d0caef33e4 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,21 +18,19 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; - +package org.onap.so.adapters.vnfrest; import java.util.HashMap; import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.entity.MsoRequest; +import org.onap.so.entity.MsoRequest; import com.fasterxml.jackson.annotation.JsonRootName; - /* README - Map<String, String> elements when marshalled to XML produce a list of <entry><key>${key}</key><value>${value}</value></entry> elements. + Map<String, String> elements when marshalled to XML produce a list of <entry><key>${MsoUtils.xmlEscape(key)}</key><value>${MsoUtils.xmlEscape(value)}</value></entry> elements. When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. */ @JsonRootName("createVfModuleRequest") @@ -58,8 +56,9 @@ public class CreateVfModuleRequest extends VfRequestCommon { private String requestType; private Boolean failIfExists; private Boolean backout; + private Boolean enableBridge; - private Map<String,String> vfModuleParams = new HashMap<>(); + private Map<String, String> vfModuleParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); public String getCloudSiteId() { @@ -205,4 +204,12 @@ public class CreateVfModuleRequest extends VfRequestCommon { public void setMsoRequest(MsoRequest msoRequest) { this.msoRequest = msoRequest; } + + public Boolean getEnableBridge() { + return this.enableBridge; + } + + public void setEnableBridge(Boolean enableBridge) { + this.enableBridge = enableBridge; + } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleResponse.java index 70c9535a32..b9d1f4c376 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleResponse.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import java.util.HashMap; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java index 2c684e0aa4..698b2ccebe 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import java.util.HashMap; @@ -26,7 +26,7 @@ import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.entity.MsoRequest; +import org.onap.so.entity.MsoRequest; import com.fasterxml.jackson.annotation.JsonRootName; @@ -43,6 +43,7 @@ public class CreateVolumeGroupRequest extends VfRequestCommon { private String modelCustomizationUuid; private Map<String,String> volumeGroupParams = new HashMap<>(); private Boolean failIfExists; + private Boolean enableBridge; private Boolean suppressBackout; private MsoRequest msoRequest = new MsoRequest(); @@ -145,4 +146,12 @@ public class CreateVolumeGroupRequest extends VfRequestCommon { public void setMsoRequest(MsoRequest msoRequest) { this.msoRequest = msoRequest; } + + public Boolean getEnableBridge() { + return enableBridge; + } + + public void setEnableBridge(Boolean enableBridge) { + this.enableBridge = enableBridge; + } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupResponse.java index 18a348aa05..d98318d3e6 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupResponse.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import java.util.HashMap; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java index b2b602ae33..6ce9b2fa4c 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java @@ -18,18 +18,24 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; +import java.io.Serializable; + import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.entity.MsoRequest; +import org.onap.so.entity.MsoRequest; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("deleteVfModuleRequest") @XmlRootElement(name = "deleteVfModuleRequest") -public class DeleteVfModuleRequest extends VfRequestCommon { +public class DeleteVfModuleRequest extends VfRequestCommon implements Serializable { + /** + * + */ + private static final long serialVersionUID = -8504083539107392561L; private String cloudSiteId; private String tenantId; private String vnfId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleResponse.java index db04d5b20c..ca713d36a0 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleResponse.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import java.util.HashMap; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.java index fc600e2d75..d17c5dd0de 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.java @@ -18,14 +18,15 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.entity.MsoRequest; +import org.onap.so.entity.MsoRequest; import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.ToStringBuilder; @JsonRootName("deleteVolumeGroupRequest") @XmlRootElement(name = "deleteVolumeGroupRequest") @@ -79,4 +80,11 @@ public class DeleteVolumeGroupRequest extends VfRequestCommon { public void setMsoRequest(MsoRequest msoRequest) { this.msoRequest = msoRequest; } + + @Override + public String toString() { + return new ToStringBuilder(this).appendSuper(super.toString()).append("cloudSiteId", cloudSiteId) + .append("tenantId", tenantId).append("volumeGroupId", volumeGroupId) + .append("volumeGroupStackId", volumeGroupStackId).append("msoRequest", msoRequest).toString(); + } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupResponse.java index 553cc0e8e0..4a7442108a 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupResponse.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVfModuleResponse.java index 222644ca1c..0214d15ee8 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVfModuleResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVfModuleResponse.java @@ -19,21 +19,21 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.beans.VnfStatus; +import org.onap.so.logger.MsoLogger; +import org.onap.so.openstack.beans.VnfStatus; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("queryVfModuleResponse") @XmlRootElement(name = "queryVfModuleResponse") public class QueryVfModuleResponse extends VfResponseCommon{ - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, QueryVfModuleResponse.class); private String vnfId; private String vfModuleId; private String vfModuleStackId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVolumeGroupResponse.java index 41226c3696..6e8027c689 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVolumeGroupResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVolumeGroupResponse.java @@ -19,22 +19,22 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.beans.VnfStatus; +import org.onap.so.logger.MsoLogger; +import org.onap.so.openstack.beans.VnfStatus; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @XmlRootElement(name = "queryVolumeGroupResponse") public class QueryVolumeGroupResponse { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, QueryVolumeGroupResponse.class); private String volumeGroupId; private String volumeGroupStackId; private VnfStatus volumeGroupStatus; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVfModuleRequest.java index aa9b35bb98..4ad7a7a417 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVfModuleRequest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVfModuleResponse.java index c77155fe81..43db90c566 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVfModuleResponse.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVolumeGroupRequest.java index d7f49fd530..14c2c2a3d9 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVolumeGroupRequest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVolumeGroupResponse.java index 22164d9508..46ac26825c 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVolumeGroupResponse.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java index c52cc60b35..0fb5c05e2a 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import java.util.HashMap; @@ -26,7 +26,7 @@ import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.entity.MsoRequest; +import org.onap.so.entity.MsoRequest; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleResponse.java index aa9a3aad31..4504bf3461 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleResponse.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import java.util.HashMap; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java index 983e81602c..d9f83aad2f 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import java.util.HashMap; @@ -26,7 +26,7 @@ import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.entity.MsoRequest; +import org.onap.so.entity.MsoRequest; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupResponse.java index d71ef275e1..8c003b1835 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupResponse.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import java.util.HashMap; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleExceptionResponse.java index 6416d2df5e..4f53531585 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleExceptionResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleExceptionResponse.java @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; +import org.onap.so.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "vfModuleException") diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java index 59bd5020d2..0e716e5924 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleRollback.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java @@ -18,13 +18,13 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.entity.MsoRequest; -import org.openecomp.mso.openstack.beans.VnfRollback; +import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.beans.VnfRollback; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfRequestCommon.java index aa6af56082..f934bc63d8 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfRequestCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfRequestCommon.java @@ -19,7 +19,9 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; + +import org.apache.commons.lang3.builder.ToStringBuilder; /** @@ -49,5 +51,11 @@ public abstract class VfRequestCommon extends VfResponseCommon { return notificationUrl == null || notificationUrl.isEmpty(); } + @Override + public String toString() { + return new ToStringBuilder(this).append("skipAAI", skipAAI).append("notificationUrl", notificationUrl) + .toString(); + } + // getMessageId, setMessageId, toJsonString, toJsonString are all defined in VfResponseCommon. } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfResponseCommon.java index 4f55c5a615..2828ac3d43 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfResponseCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfResponseCommon.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import java.io.ByteArrayOutputStream; @@ -27,7 +27,7 @@ import java.io.ByteArrayOutputStream; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.logger.MsoLogger; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -37,7 +37,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; * except for QueryVfModuleResponse and QueryVolumeGroupResponse. */ public abstract class VfResponseCommon { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, VfResponseCommon.class); private String messageId; public VfResponseCommon() { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupExceptionResponse.java index 4c3a0a6d60..2e5801b4ae 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupExceptionResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupExceptionResponse.java @@ -18,12 +18,12 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; +import org.onap.so.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "volumeGroupException") public class VolumeGroupExceptionResponse extends VfModuleExceptionResponse { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.java index c815a7658c..2795ba0de3 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupRollback.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.java @@ -18,12 +18,12 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnfrest; +package org.onap.so.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.entity.MsoRequest; +import org.onap.so.entity.MsoRequest; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HeatStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HeatStatus.java index 8e223b7bcb..dd68d37736 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HeatStatus.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HeatStatus.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; +package org.onap.so.openstack.beans; /* diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HostRoute.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java index 4d9dc0009e..228bb2c03d 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HostRoute.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; +package org.onap.so.openstack.beans; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/MsoTenant.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/MsoTenant.java index 5e037096df..b06ea0e59f 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/MsoTenant.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/MsoTenant.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; +package org.onap.so.openstack.beans; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkInfo.java index 64460b20bb..6110fa5073 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkInfo.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkInfo.java @@ -18,21 +18,19 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; +package org.onap.so.openstack.beans; + + import java.util.ArrayList; import java.util.List; -import java.util.Map; -import java.util.HashMap; - -import com.woorea.openstack.quantum.model.Network; -import com.woorea.openstack.quantum.model.Segment; /* * This Java bean class relays Network details (including status) to ActiveVOS processes. * * This bean is returned by all Network-specific adapter operations (create, query, delete) */ + public class NetworkInfo { // Set defaults for everything private String name = ""; @@ -41,56 +39,15 @@ public class NetworkInfo { private String provider = ""; private List<Integer> vlans = new ArrayList<>(); private List<String> subnets = new ArrayList<>(); + private String shared = ""; - static Map<String,NetworkStatus> NetworkStatusMap; - static { - NetworkStatusMap = new HashMap<>(); - NetworkStatusMap.put("ACTIVE", NetworkStatus.ACTIVE); - NetworkStatusMap.put("DOWN", NetworkStatus.DOWN); - NetworkStatusMap.put("BUILD", NetworkStatus.BUILD); - NetworkStatusMap.put("ERROR", NetworkStatus.ERROR); - } - - /** - * Capture the data from a Neutron Network object. - * - * For MSO, there are assumptions regarding all networks. - * - Everything will be a provider network - * - All provider networks are VLANs - * - Multiple VLANs are supported, and indicated by multi-provider segments. - * Each will have the same physical network & network type "vlan". - * - * @param network - */ - public NetworkInfo(Network network) { - if (network != null) { - initFieldsWithDataFromNetwork(network); - } else { - status = NetworkStatus.NOTFOUND; - } - } - - private void initFieldsWithDataFromNetwork(Network network){ - name = network.getName(); - id = network.getId(); - - if (network.getStatus() != null && NetworkStatusMap.containsKey(network.getStatus())) { - status = NetworkStatusMap.get(network.getStatus()); - } - if (network.getProviderPhysicalNetwork() != null) { - provider = network.getProviderPhysicalNetwork(); - if ("vlan".equals(network.getProviderNetworkType())) { - vlans.add(network.getProviderSegmentationId()); - } - } - else if (network.getSegments() != null && !network.getSegments().isEmpty()) { - Segment s = network.getSegments().get(0); - provider = s.getProviderPhysicalNetwork(); - if ("vlan".equals(s.getProviderNetworkType())) { - network.getSegments().forEach(segment -> vlans.add(segment.getProviderSegmentationId())); - } - } - subnets = network.getSubnets(); + public NetworkInfo () { + } + + public NetworkInfo (String name, NetworkStatus status) { + this.name = name; + this.id = name; // Don't have an ID, so just use name + this.status = status; } public String getName() { @@ -137,6 +94,18 @@ public class NetworkInfo { return subnets; } + public void setSubnets (List<String> subnets) { + this.subnets = subnets; + } + + public String getShared() { + return shared; + } + + public void setShared(String shared) { + this.shared = shared; + } + @Override public String toString() { return "NetworkInfo{" + "name='" + name + '\'' + diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkRollback.java index a965122921..e95c564f27 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkRollback.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,12 +18,13 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; +package org.onap.so.openstack.beans; +import java.io.Serializable; import java.util.List; -import org.openecomp.mso.entity.MsoRequest; +import org.onap.so.entity.MsoRequest; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -40,7 +41,11 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; * */ @JsonInclude(Include.NON_EMPTY) -public class NetworkRollback { +public class NetworkRollback implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 11949663223019185L; private String networkId; private String neutronNetworkId; private String networkStackId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkStatus.java index 199028e56c..b7b1366562 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkStatus.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkStatus.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; +package org.onap.so.openstack.beans; /** diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Pool.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Pool.java index a3a04abc60..1c82907f80 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Pool.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Pool.java @@ -18,19 +18,12 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; +package org.onap.so.openstack.beans; + -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "start", - "end" -}) public class Pool { private String start; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/RouteTarget.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/RouteTarget.java index 7903b08ff9..fcea8796c2 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/RouteTarget.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/RouteTarget.java @@ -18,7 +18,9 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; +package org.onap.so.openstack.beans; + +import java.io.Serializable; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -29,8 +31,12 @@ import javax.xml.bind.annotation.XmlType; "routeTarget", "routeTargetRole" }) -public class RouteTarget { +public class RouteTarget implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 5425083030715789604L; private String routeTarget; private String routeTargetRole; @@ -43,7 +49,7 @@ public class RouteTarget { public String getRouteTargetRole() { return routeTargetRole; } - public void setRole(String routeTargetRole) { + public void setRouteTargetRole(String routeTargetRole) { this.routeTargetRole = routeTargetRole; } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/StackInfo.java index e88b5f87a0..028ec9ec8d 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/StackInfo.java @@ -18,13 +18,11 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; +package org.onap.so.openstack.beans; -import java.util.Map; import java.util.HashMap; - -import com.woorea.openstack.heat.model.Stack; +import java.util.Map; /* * This Java bean class relays Heat stack status information to ActiveVOS processes. @@ -40,20 +38,6 @@ public class StackInfo { private String statusMessage = ""; private Map<String,Object> outputs = new HashMap<>(); private Map<String,Object> parameters = new HashMap<>(); - - static Map<String,HeatStatus> HeatStatusMap; - static { - HeatStatusMap = new HashMap<>(); - HeatStatusMap.put("CREATE_IN_PROGRESS", HeatStatus.BUILDING); - HeatStatusMap.put("CREATE_COMPLETE", HeatStatus.CREATED); - HeatStatusMap.put("CREATE_FAILED", HeatStatus.FAILED); - HeatStatusMap.put("DELETE_IN_PROGRESS", HeatStatus.DELETING); - HeatStatusMap.put("DELETE_COMPLETE", HeatStatus.NOTFOUND); - HeatStatusMap.put("DELETE_FAILED", HeatStatus.FAILED); - HeatStatusMap.put("UPDATE_IN_PROGRESS", HeatStatus.UPDATING); - HeatStatusMap.put("UPDATE_FAILED", HeatStatus.FAILED); - HeatStatusMap.put("UPDATE_COMPLETE", HeatStatus.UPDATED); - } public StackInfo () { } @@ -73,36 +57,6 @@ public class StackInfo { this.status = status; } - public StackInfo (Stack stack) - { - if (stack == null) { - this.status = HeatStatus.NOTFOUND; - return; - } - - this.name = stack.getStackName(); - this.canonicalName = stack.getStackName() + "/" + stack.getId(); - - if (stack.getStackStatus() == null) { - this.status = HeatStatus.INIT; - } else if (HeatStatusMap.containsKey(stack.getStackStatus())) { - this.status = HeatStatusMap.get(stack.getStackStatus()); - } else { - this.status = HeatStatusMap.getOrDefault(stack.getStackStatus(), HeatStatus.UNKNOWN); - } - - this.statusMessage = stack.getStackStatusReason(); - - if (stack.getOutputs() != null) { - this.outputs = new HashMap<>(); - for (Stack.Output output : stack.getOutputs()) { - this.outputs.put(output.getOutputKey(), output.getOutputValue()); - } - } - - this.parameters = stack.getParameters(); - } - public String getName() { return name; } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Subnet.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Subnet.java index 086395cc93..3213323101 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Subnet.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Subnet.java @@ -18,15 +18,21 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; +package org.onap.so.openstack.beans; +import java.io.Serializable; import java.util.List; import javax.xml.bind.annotation.XmlTransient; -public class Subnet { +public class Subnet implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -530027355187604839L; private String subnetName; @@ -36,7 +42,7 @@ public class Subnet { private String cidr; //Only field required - private String gatewayIp=""; + private String gatewayIp; private String ipVersion="4"; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java index c4f63138e0..ba7f6532e1 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,9 +18,9 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; +package org.onap.so.openstack.beans; -import org.openecomp.mso.entity.MsoRequest; +import org.onap.so.entity.MsoRequest; /** * Javabean representing the rollback criteria following a "Create VNF" * operation. This structure can be passed back to the "Rollback VNF" @@ -79,7 +79,6 @@ public class VnfRollback { } /** - * For backwards compatibility... orchestration mode defaults to HEAT * * @param vnfId * @param tenantId diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfStatus.java index cc7e66eecb..9f1ae8813d 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfStatus.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfStatus.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.beans; +package org.onap.so.openstack.beans; /* diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoAdapterException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoAdapterException.java index 454880cee1..31c4727934 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoAdapterException.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoAdapterException.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudIdentityNotFound.java index 7e21d9d15a..31f3f6f7dd 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudIdentityNotFound.java @@ -18,24 +18,31 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; + /** - * Signals that an attempt to find a specific mso cloud identity has failed. + * Cloud site not found exception. */ public class MsoCloudIdentityNotFound extends MsoException { + /** + * Serialization id. + */ private static final long serialVersionUID = 2583769056266415665L; - /** * Default constructor (needed for BPEL/JAXB) */ public MsoCloudIdentityNotFound () { super("Cloud Identity not found"); super.category=MsoExceptionCategory.USERDATA; - } - + } + + /** + * Constructor to create a new MsoOpenstackException instance + * @param cloudSite the cloud site + */ public MsoCloudIdentityNotFound (String cloudIdentity) { // Set the detailed error as the Exception 'message' super("Cloud Identity [" + cloudIdentity + "] not found"); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFound.java index 7c6e98d55f..ceb08d8ccb 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFound.java @@ -18,13 +18,17 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; + /** - * Signals that an attempt to find a specific mso cloud site has failed. + * Cloud site not found exception. */ public class MsoCloudSiteNotFound extends MsoException { + /** + * Serialization id. + */ private static final long serialVersionUID = 2583769056266415664L; /** @@ -34,7 +38,11 @@ public class MsoCloudSiteNotFound extends MsoException { super("Cloud site not found"); super.category=MsoExceptionCategory.USERDATA; } - + + /** + * Constructor to create a new MsoOpenstackException instance + * @param cloudSite the cloud site + */ public MsoCloudSiteNotFound (String cloudSite) { // Set the detailed error as the Exception 'message' super("Cloud Site [" + cloudSite + "] not found"); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoException.java index b8a7a5571c..625914e820 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoException.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoException.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoExceptionCategory.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoExceptionCategory.java index 81a0edc2d3..ed57488301 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoExceptionCategory.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoExceptionCategory.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoHeatNotFoundException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoHeatNotFoundException.java new file mode 100644 index 0000000000..dda7384d9e --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoHeatNotFoundException.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.openstack.exceptions; + +/** + * MSO Heat not found exception. + */ +public class MsoHeatNotFoundException extends MsoException { + /** + * Serialization id. + */ + private static final long serialVersionUID = 6547134336163166841L; + + /** + * Default constructor (needed for BPEL/JAXB) + */ + public MsoHeatNotFoundException() { + super("Heat not found"); + super.category = MsoExceptionCategory.USERDATA; + } + + /** + * Constructor to create a new MsoHeatNotFoundException instance + * @param heat the heat parameter + */ + public MsoHeatNotFoundException(String heat) { + // Set the detailed error as the Exception 'message' + super("Heat [" + heat + "] not found"); + super.category = MsoExceptionCategory.USERDATA; + } + + @Override + public String toString() { + return getMessage(); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoIOException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoIOException.java index 9c7f6fa91a..35f2445d41 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoIOException.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoIOException.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; /** diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExists.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkAlreadyExists.java index 98b85394be..dd7817d310 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExists.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkAlreadyExists.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; @@ -29,7 +29,7 @@ public class MsoNetworkAlreadyExists extends MsoOpenstackException { // Constructor to create a new MsoOpenstackException instance public MsoNetworkAlreadyExists (String stack, String tenant, String cloud) { // Set the detailed error as the Exception 'message' - super(409, "Conflict", "Stack " + stack + " already exists in Tenant + " + tenant + " in Cloud " + cloud); + super(409, "Conflict", "Stack " + stack + " already exists in Tenant " + tenant + " in Cloud " + cloud); } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkNotFound.java index 5802aa1208..7306142cd0 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFound.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkNotFound.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoOpenstackException.java index eead8439d4..1410650dd2 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackException.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoOpenstackException.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; /** diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExists.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackAlreadyExists.java index 2901b6b3a7..fc98ee95ed 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExists.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackAlreadyExists.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; @@ -29,7 +29,7 @@ public class MsoStackAlreadyExists extends MsoOpenstackException { // Constructor to create a new MsoOpenstackException instance public MsoStackAlreadyExists (String stack, String tenant, String cloud) { // Set the detailed error as the Exception 'message' - super(409, "Conflict", "Stack " + stack + " already exists in Tenant + " + tenant + " in Cloud " + cloud); + super(409, "Conflict", "Stack " + stack + " already exists in Tenant " + tenant + " in Cloud " + cloud); } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackNotFound.java index 21082a28c9..1cd6b9650a 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFound.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackNotFound.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; /** diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantAlreadyExists.java index 7a597d6f4d..5da32847b1 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantAlreadyExists.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,15 +18,18 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; + + public class MsoTenantAlreadyExists extends MsoOpenstackException { private static final long serialVersionUID = 1L; + // Constructor to create a new MsoOpenstackException instance public MsoTenantAlreadyExists (String tenant, String cloud) { // Set the detailed error as the Exception 'message' super(409, "Conflict", "Tenant " + tenant + " already exists in Cloud " + cloud); } - + } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantNotFound.java index f26d6b6d49..9b135b61b2 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFound.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantNotFound.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; /** diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/NetworkInfoMapper.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/NetworkInfoMapper.java new file mode 100644 index 0000000000..aa0f17810e --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/NetworkInfoMapper.java @@ -0,0 +1,107 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.openstack.mappers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.javatuples.Pair; +import org.onap.so.openstack.beans.NetworkInfo; +import org.onap.so.openstack.beans.NetworkStatus; + +import com.woorea.openstack.quantum.model.Network; +import com.woorea.openstack.quantum.model.Segment; + +public class NetworkInfoMapper { + + private final Network network; + private final Map<String,NetworkStatus> networkStatusMap = new HashMap<>(); + + public NetworkInfoMapper(Network network) { + this.network = network; + configureNetworkStatusMap(); + } + + /** + * Capture the data from a Neutron Network object. + * + * For MSO, there are assumptions regarding all networks. + * - Everything will be a provider network + * - All provider networks are VLANs + * - Multiple VLANs are supported, and indicated by multi-provider segments. + * Each will have the same physical network & network type "vlan". + * + * @param network + */ + public NetworkInfo map() { + final NetworkInfo info = new NetworkInfo(); + if (network == null) { + info.setStatus(NetworkStatus.NOTFOUND); + } else { + info.setName(network.getName()); + info.setId(network.getId()); + info.setStatus(this.mapStatus(network.getStatus())); + Pair<Optional<String>, List<Integer>> result = locateVlanInformation(network); + Optional<String> value0 = result.getValue0(); + if (value0.isPresent()) { + info.setProvider(value0.get()); + } + info.setVlans(result.getValue1()); + info.setSubnets(network.getSubnets()); + } + return info; + } + + protected NetworkStatus mapStatus(String status) { + return networkStatusMap.getOrDefault(status, NetworkStatus.UNKNOWN); + } + + protected Pair<Optional<String>, List<Integer>> locateVlanInformation(Network network) { + final List<Integer> vlans = new ArrayList<>(); + Optional<String> provider = Optional.empty(); + if (network.getProviderPhysicalNetwork() != null) { + provider = Optional.ofNullable(network.getProviderPhysicalNetwork()); + if ("vlan".equals(network.getProviderNetworkType())) { + vlans.add(network.getProviderSegmentationId()); + } + } else if (network.getSegments() != null && !network.getSegments().isEmpty()) { + Segment s = network.getSegments().get(0); + provider = Optional.ofNullable(s.getProviderPhysicalNetwork()); + if ("vlan".equals(s.getProviderNetworkType())) { + for (Segment s1 : network.getSegments()) { + vlans.add(s1.getProviderSegmentationId()); + } + } + } + + return Pair.with(provider, vlans); + } + + private void configureNetworkStatusMap() { + networkStatusMap.put("ACTIVE", NetworkStatus.ACTIVE); + networkStatusMap.put("DOWN", NetworkStatus.DOWN); + networkStatusMap.put("BUILD", NetworkStatus.BUILD); + networkStatusMap.put("ERROR", NetworkStatus.ERROR); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/StackInfoMapper.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/StackInfoMapper.java new file mode 100644 index 0000000000..85fd6cc279 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/StackInfoMapper.java @@ -0,0 +1,99 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.openstack.mappers; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.onap.so.openstack.beans.HeatStatus; +import org.onap.so.openstack.beans.StackInfo; + +import com.woorea.openstack.heat.model.Stack; +import com.woorea.openstack.heat.model.Stack.Output; + +public class StackInfoMapper { + + private final Stack stack; + private final Map<String,HeatStatus> heatStatusMap = new HashMap<>(); + public StackInfoMapper(Stack stack) { + this.stack = stack; + configureHeatStatusMap(); + } + + public StackInfo map() { + final StackInfo info = new StackInfo(); + if (stack == null) { + info.setStatus(HeatStatus.NOTFOUND); + } else { + info.setName(stack.getStackName()); + info.setCanonicalName(stack.getStackName() + "/" + stack.getId()); + info.setStatus(this.mapStatus(stack.getStackStatus())); + + info.setStatusMessage(stack.getStackStatusReason()); + + Optional<Map<String, Object>> result = this.mapOutputToMap(stack.getOutputs()); + if (result.isPresent()) { + info.setOutputs(result.get()); + } + + info.setParameters(stack.getParameters()); + } + + return info; + } + + protected HeatStatus mapStatus(String status) { + final HeatStatus result; + if (status == null) { + result = HeatStatus.INIT; + } else { + result = heatStatusMap.getOrDefault(status, HeatStatus.UNKNOWN); + } + + return result; + } + + protected Optional<Map<String, Object>> mapOutputToMap(List<Output> outputs) { + Optional<Map<String, Object>> result = Optional.empty(); + if (outputs != null) { + final HashMap<String, Object> map = new HashMap<>(); + for (Output output : outputs) { + map.put(output.getOutputKey(), output.getOutputValue()); + } + result = Optional.of(map); + } + + return result; + } + private void configureHeatStatusMap() { + heatStatusMap.put("CREATE_IN_PROGRESS", HeatStatus.BUILDING); + heatStatusMap.put("CREATE_COMPLETE", HeatStatus.CREATED); + heatStatusMap.put("CREATE_FAILED", HeatStatus.FAILED); + heatStatusMap.put("DELETE_IN_PROGRESS", HeatStatus.DELETING); + heatStatusMap.put("DELETE_COMPLETE", HeatStatus.NOTFOUND); + heatStatusMap.put("DELETE_FAILED", HeatStatus.FAILED); + heatStatusMap.put("UPDATE_IN_PROGRESS", HeatStatus.UPDATING); + heatStatusMap.put("UPDATE_FAILED", HeatStatus.FAILED); + heatStatusMap.put("UPDATE_COMPLETE", HeatStatus.UPDATED); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java deleted file mode 100644 index 5bb1dacb4a..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.adapters.json; - -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.JsonParser; -import org.codehaus.jackson.map.DeserializationContext; -import org.codehaus.jackson.map.JsonDeserializer; -import org.codehaus.jackson.map.ObjectMapper; - -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * Custom JSON Deserializer for Map<String, String>. - * In MSO with Jackson 1.9.12 and RestEasy 3.0.8, maps in JSON are serialized as - * follows: - * <pre> - * "params": { - * "entry": [ - * {"key": "P1", "value": "V1"}, - * {"key": "P2", "value": "V2"}, - * ... - * {"key": "PN", "value": "VN"} - * ] - * } - * The implementation uses a LinkedHashMap to preserve the ordering of entries. - * </pre> - */ -public class MapDeserializer extends JsonDeserializer<Map<String, String>> { - - @Override - public Map<String, String> deserialize(JsonParser parser, - DeserializationContext context) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - JsonNode tree = mapper.readTree(parser); - Map<String, String> map = new LinkedHashMap<>(); - if (tree == null) - return map; - for (JsonNode element : tree) { - for (JsonNode arrayElement : element) { - String key = arrayElement.get("key").getTextValue(); - String value = arrayElement.get("value").getTextValue(); - map.put(key, value); - } - } - return map; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java deleted file mode 100644 index 3e9f5c6b58..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.adapters.json; - -import org.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.map.JsonSerializer; -import org.codehaus.jackson.map.SerializerProvider; - -import java.io.IOException; -import java.util.Map; - -/** - * Custom JSON Serializer for Map<String, String>. - * In MSO with Jackson 1.9.12 and RestEasy 3.0.8, maps in JSON are serialized as - * follows: - * <pre> - * "params": { - * "entry": [ - * {"key": "P1", "value": "V1"}, - * {"key": "P2", "value": "V2"}, - * ... - * {"key": "PN", "value": "VN"} - * ] - * } - * </pre> - * The implementation uses a TreeMap, so entries are always sorted according - * to the natural ordering of the keys. - */ -public class MapSerializer extends JsonSerializer<Map<String, String>> { - @Override - public void serialize(Map<String, String> map, JsonGenerator jsonGenerator, - SerializerProvider serializerProvider) throws IOException { - jsonGenerator.writeStartObject(); - jsonGenerator.writeArrayFieldStart("entry"); - for (Map.Entry<String,String> entry : map.entrySet()) { - String key = entry.getKey(); - String value = entry.getValue(); - jsonGenerator.writeStartObject(); - jsonGenerator.writeStringField("key", key); - jsonGenerator.writeStringField("value", value); - jsonGenerator.writeEndObject(); - } - jsonGenerator.writeEndArray(); - jsonGenerator.writeEndObject(); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/providers/JettisonStyleMapperProvider.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/providers/JettisonStyleMapperProvider.java deleted file mode 100644 index aa55c6349d..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/providers/JettisonStyleMapperProvider.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.providers; - -import javax.ws.rs.Produces; -import javax.ws.rs.ext.ContextResolver; -import javax.ws.rs.ext.Provider; - -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -@Provider -@Produces("application/json") -public class JettisonStyleMapperProvider implements ContextResolver<ObjectMapper> { - - final ObjectMapper mapper; - - public JettisonStyleMapperProvider() { - - mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - mapper.enable(MapperFeature.USE_ANNOTATIONS); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - } - - @Override - public ObjectMapper getContext(Class<?> type) { - return mapper; - } -}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/HealthCheckHandler.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/HealthCheckHandler.java deleted file mode 100644 index dac3b9ea3c..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/HealthCheckHandler.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.tenantrest; - - - -import javax.ws.rs.GET; -import javax.ws.rs.HEAD; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; - -import org.apache.http.HttpStatus; - -import org.openecomp.mso.logger.MsoLogger; - -@Path("/") -public class HealthCheckHandler { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>"; - private static final Response HEALTH_CHECK_RESPONSE = Response.status (HttpStatus.SC_OK) - .entity (CHECK_HTML) - .build (); - @HEAD - @GET - @Path("/healthcheck") - @Produces("text/html") - public Response healthcheck () { - msoLogger.debug ("Health check call in Tenant Adapter"); - return HEALTH_CHECK_RESPONSE; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/BeansTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/BeansTest.java new file mode 100644 index 0000000000..e3474009c9 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/BeansTest.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters; + +import org.junit.Test; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoClassFilter; +import com.openpojo.reflection.filters.FilterNonConcrete; +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.rule.impl.SetterMustExistRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + + +public class BeansTest { + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + @Test + public void pojoStructure() { + test("org.onap.so.adapters.nwrest"); + test("org.onap.so.adapters.sdncrest"); + test("org.onap.so.adapters.tenantrest"); + test("org.onap.so.adapters.vnfrest"); + test("org.onap.so.adapters.network.beans"); + test("org.onap.so.openstack.beans"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create() + .with(new GetterMustExistRule()) + .with(new SetterMustExistRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .build(); + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, new FilterNonConcrete()); + } + + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/network/mappers/ContrailSubnetMappersTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/network/mappers/ContrailSubnetMappersTest.java new file mode 100644 index 0000000000..240074bca7 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/network/mappers/ContrailSubnetMappersTest.java @@ -0,0 +1,236 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.network.mappers; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.junit.Test; +import org.onap.so.adapters.network.beans.ContrailSubnet; +import org.onap.so.adapters.network.beans.ContrailSubnetHostRoute; +import org.onap.so.adapters.network.beans.ContrailSubnetHostRoutes; +import org.onap.so.adapters.network.beans.ContrailSubnetIp; +import org.onap.so.adapters.network.beans.ContrailSubnetPool; +import org.onap.so.openstack.beans.HostRoute; +import org.onap.so.openstack.beans.Pool; +import org.onap.so.openstack.beans.Subnet; + +public class ContrailSubnetMappersTest { + + + + @Test + public void contrailSubnetHostRouteMapperTest() { + HostRoute hostRoute = new HostRoute(); + hostRoute.setNextHop("hop"); + hostRoute.setPrefix("prefix"); + ContrailSubnetHostRouteMapper mapper = new ContrailSubnetHostRouteMapper(hostRoute); + ContrailSubnetHostRoute cshr = mapper.map(); + assertEquals("hop", cshr.getNextHop()); + assertEquals("prefix", cshr.getPrefix()); + } + + @Test + public void contrailSubnetPoolMapperTest() { + Pool pool = new Pool(); + pool.setStart("start"); + pool.setEnd("end"); + ContrailSubnetPoolMapper mapper = new ContrailSubnetPoolMapper(pool); + ContrailSubnetPool csPool = mapper.map(); + assertEquals("start", csPool.getStart()); + assertEquals("end", csPool.getEnd()); + } + + @Test + public void checkIsNullOrEmpty() { + ContrailSubnetMapper mapper = new ContrailSubnetMapper(null); + assertEquals(true, mapper.isNullOrEmpty("")); + assertEquals(true, mapper.isNullOrEmpty(null)); + assertEquals(false, mapper.isNullOrEmpty("hello")); + } + + @Test + public void createSubnetTestValidCidr() { + Subnet subnet = new Subnet(); + subnet.setCidr("test/value"); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + + assertEquals("test",result.getSubnet().getIpPrefix()); + assertEquals("value", result.getSubnet().getIpPrefixLen()); + } + + @Test + public void createSubnetTestInvalidCidr() { + Subnet subnet = new Subnet(); + subnet.setCidr("test"); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + assertEquals(null, result.getSubnet().getIpPrefix()); + assertEquals(null, result.getSubnet().getIpPrefixLen()); + + } + + @Test + public void createSubnetTestNullCidr() { + Subnet subnet = new Subnet(); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + assertEquals(null, result.getSubnet().getIpPrefix()); + assertEquals(null, result.getSubnet().getIpPrefixLen()); + } + + @Test + public void createContrailSubnetPoolTest() { + List<Pool> pools = new ArrayList<>(); + Pool pool1 = new Pool(); + pool1.setStart("start1"); + pool1.setEnd("end1"); + Pool pool2 = new Pool(); + pool2.setStart("start2"); + pool2.setEnd("end2"); + pools.add(pool1); + pools.add(pool2); + + Subnet subnet = new Subnet(); + subnet.setAllocationPools(pools); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + List<ContrailSubnetPool> cspools = result.getAllocationPools(); + assertEquals(2, cspools.size()); + assertEquals("start2", cspools.get(1).getStart()); + assertEquals("end2", cspools.get(1).getEnd()); + } + + @Test + public void createContrailSubnetPoolInvalidTest() { + List<Pool> pools = new ArrayList<>(); + Pool pool1 = new Pool(); + pool1.setStart("start1"); + pool1.setEnd("end1"); + Pool pool2 = new Pool(); + pool2.setStart("start2"); + pools.add(pool1); + pools.add(pool2); + + Subnet subnet = new Subnet(); + subnet.setAllocationPools(pools); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + List<ContrailSubnetPool> cspools = result.getAllocationPools(); + assertEquals(1, cspools.size()); + assertEquals("start1", cspools.get(0).getStart()); + assertEquals("end1", cspools.get(0).getEnd()); + } + + @Test + public void createContrailSubnetPoolEmptyTest() { + + Subnet subnet = new Subnet(); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + List<ContrailSubnetPool> cspools = result.getAllocationPools(); + assertEquals(true, cspools.isEmpty()); + + } + + @Test + public void createContrailSubnetHostRoutesTest() { + List<HostRoute> hostRoutes = new ArrayList<>(); + HostRoute hostRoute1 = new HostRoute(); + hostRoute1.setNextHop("next-hop1"); + hostRoute1.setPrefix("prefix1"); + HostRoute hostRoute2 = new HostRoute(); + hostRoute2.setNextHop("next-hop2"); + hostRoute2.setPrefix("prefix2"); + hostRoutes.add(hostRoute1); + hostRoutes.add(hostRoute2); + + Subnet subnet = new Subnet(); + subnet.setHostRoutes(hostRoutes); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + ContrailSubnetHostRoutes routes = result.getHostRoutes(); + assertEquals(2, routes.getHostRoutes().size()); + assertEquals("next-hop2", routes.getHostRoutes().get(1).getNextHop()); + assertEquals("prefix2", routes.getHostRoutes().get(1).getPrefix()); + } + + @Test + public void createContrailSubnetHostRoutesMissingFieldTest() { + List<HostRoute> hostRoutes = new ArrayList<>(); + HostRoute hostRoute1 = new HostRoute(); + hostRoute1.setNextHop("next-hop1"); + HostRoute hostRoute2 = new HostRoute(); + hostRoute2.setNextHop("next-hop2"); + hostRoute2.setPrefix("prefix2"); + hostRoutes.add(hostRoute1); + hostRoutes.add(hostRoute2); + + Subnet subnet = new Subnet(); + subnet.setHostRoutes(hostRoutes); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + ContrailSubnetHostRoutes routes = result.getHostRoutes(); + assertEquals(2, routes.getHostRoutes().size()); + assertEquals("next-hop1", routes.getHostRoutes().get(0).getNextHop()); + assertEquals("prefix2", routes.getHostRoutes().get(1).getPrefix()); + } + + @Test + public void createContrailSubnetHostRoutesEmptyTest() { + List<HostRoute> hostRoutes = new ArrayList<>(); + Subnet subnet = new Subnet(); + subnet.setHostRoutes(hostRoutes); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + ContrailSubnetHostRoutes routes = result.getHostRoutes(); + assertEquals(true, routes.getHostRoutes().isEmpty()); + } + + @Test + public void getSubnetNameTest() { + Subnet subnet = new Subnet(); + subnet.setSubnetName("name"); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + assertEquals("if subnetName is populated map", "name", mapper.getSubnetName(subnet)); + subnet = new Subnet(); + subnet.setSubnetId("id"); + mapper = new ContrailSubnetMapper(subnet); + assertEquals("choose id when name is null", "id", mapper.getSubnetName(subnet)); + subnet = new Subnet(); + mapper = new ContrailSubnetMapper(subnet); + assertEquals("expect null", null, mapper.getSubnetName(subnet)); + } + @Test + public void mapRemainingFields() { + Subnet subnet = new Subnet(); + subnet.setEnableDHCP(true); + subnet.setGatewayIp("gateway-ip"); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + assertEquals(true, result.isEnableDhcp()); + assertEquals("gateway-ip", result.getDefaultGateway()); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/nwrest/NetworkRequestTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/nwrest/NetworkRequestTest.java new file mode 100644 index 0000000000..08851c2ce9 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/nwrest/NetworkRequestTest.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class NetworkRequestTest { + + + @Test + public void isSynchronousTrue() { + CreateNetworkRequest networkResponse = new CreateNetworkRequest(); + assertEquals(true, networkResponse.isSynchronous()); + //flip synchronous to false in the background + networkResponse.setNotificationUrl("testtest"); + assertEquals(false, networkResponse.isSynchronous()); + networkResponse.setNotificationUrl(""); + assertEquals(true, networkResponse.isSynchronous()); + } + + @Test + public void isContrailRequest() { + CreateNetworkRequest networkResponse = new CreateNetworkRequest(); + assertEquals(false, networkResponse.isContrailRequest()); + networkResponse.setNetworkTechnology(NetworkTechnology.CONTRAIL); + assertEquals(false, networkResponse.isContrailRequest()); + networkResponse.setContrailNetwork(new ContrailNetwork()); + assertEquals(true, networkResponse.isContrailRequest()); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/vdu/BeansTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/vdu/BeansTest.java new file mode 100644 index 0000000000..e681d43256 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/vdu/BeansTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vdu; + +import org.junit.Test; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoClassFilter; +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + +public class BeansTest { + + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + @Test + public void pojoStructure() { + test("org.onap.so.adapters.vdu"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create() + .with(new GetterMustExistRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .build(); + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses); + } + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoAdapterExceptionTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoAdapterExceptionTest.java new file mode 100644 index 0000000000..28a4a8302f --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoAdapterExceptionTest.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.openstack.exceptions; + +import org.junit.Test; +import org.junit.Assert; + +public class MsoAdapterExceptionTest { + + @Test + public void testConstructor() { + MsoAdapterException msoAdapterException = new MsoAdapterException("test"); + Assert.assertEquals("test",msoAdapterException.getMessage()); + Assert.assertEquals(MsoExceptionCategory.INTERNAL, msoAdapterException.category); + } + + @Test + public void testOverloadedConstructor() { + MsoAdapterException msoAdapterException = new MsoAdapterException("test" , new Throwable()); + Assert.assertEquals("test",msoAdapterException.getMessage()); + Assert.assertEquals(MsoExceptionCategory.INTERNAL, msoAdapterException.category); + Assert.assertNotNull(msoAdapterException.getCause()); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoCloudIdentityNotFoundTest.java index 4027aa6342..e7befed71a 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFoundTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoCloudIdentityNotFoundTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,10 +17,27 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; + +import org.junit.Test; +import org.junit.Assert; public class MsoCloudIdentityNotFoundTest { - MsoCloudIdentityNotFound msoCloudIdentityNotFound = new MsoCloudIdentityNotFound(); - MsoCloudIdentityNotFound msoCloudIdentityNotFoundStr = new MsoCloudIdentityNotFound("test"); - public String str = msoCloudIdentityNotFound.toString(); + + @Test + public void testConstructor() { + MsoCloudIdentityNotFound msoCloudIdentityNotFound = new MsoCloudIdentityNotFound(); + Assert.assertEquals("Cloud Identity not found",msoCloudIdentityNotFound.getMessage()); + Assert.assertEquals("Cloud Identity not found",msoCloudIdentityNotFound.toString()); + Assert.assertEquals(MsoExceptionCategory.USERDATA, msoCloudIdentityNotFound.category); + } + + @Test + public void testOverloadedConstructor() { + MsoCloudIdentityNotFound msoCloudIdentityNotFound = new MsoCloudIdentityNotFound("test"); + Assert.assertEquals("Cloud Identity [test] not found",msoCloudIdentityNotFound.getMessage()); + Assert.assertEquals("Cloud Identity [test] not found",msoCloudIdentityNotFound.toString()); + Assert.assertEquals(MsoExceptionCategory.USERDATA, msoCloudIdentityNotFound.category); + } + } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFoundTest.java new file mode 100644 index 0000000000..c75a66e100 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFoundTest.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.openstack.exceptions; + +import org.junit.Test; +import org.junit.Assert; + +public class MsoCloudSiteNotFoundTest { + + @Test + public void testConstructor() { + MsoCloudSiteNotFound msoCloudSiteNotFound = new MsoCloudSiteNotFound(); + Assert.assertEquals("Cloud site not found",msoCloudSiteNotFound.getMessage()); + Assert.assertEquals("Cloud site not found",msoCloudSiteNotFound.toString()); + Assert.assertEquals(MsoExceptionCategory.USERDATA, msoCloudSiteNotFound.category); + } + + @Test + public void testOverloadedConstructor() { + MsoCloudSiteNotFound msoCloudSiteNotFound = new MsoCloudSiteNotFound("test"); + Assert.assertEquals("Cloud Site [test] not found",msoCloudSiteNotFound.getMessage()); + Assert.assertEquals("Cloud Site [test] not found",msoCloudSiteNotFound.toString()); + Assert.assertEquals(MsoExceptionCategory.USERDATA, msoCloudSiteNotFound.category); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoIOExceptionTest.java index d1f4db778e..e257e52cd4 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoIOExceptionTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,10 +17,26 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; + +import org.junit.Test; +import org.junit.Assert; public class MsoIOExceptionTest { - MsoIOException msoIOException = new MsoIOException("test"); - MsoIOException msoIOExceptionTh = new MsoIOException("test" , new Throwable()); - public String str = msoIOException.toString(); + + @Test + public void testConstructor() { + MsoIOException msoIOException = new MsoIOException("test"); + Assert.assertEquals("test",msoIOException.getMessage()); + Assert.assertEquals(MsoExceptionCategory.IO, msoIOException.category); + } + + @Test + public void testOverloadedConstructor() { + MsoIOException msoIOException = new MsoIOException("test", new Throwable()); + Assert.assertEquals("test",msoIOException.getMessage()); + Assert.assertEquals(MsoExceptionCategory.IO, msoIOException.category); + Assert.assertNotNull(msoIOException.getCause()); + } + } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoNetworkAlreadyExistsTest.java index c5217e4933..96ff89c094 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoNetworkAlreadyExistsTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,8 +18,18 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; + +import org.junit.Test; +import org.junit.Assert; public class MsoNetworkAlreadyExistsTest { - MsoNetworkAlreadyExists msoNetworkAlreadyExists = new MsoNetworkAlreadyExists("test","test","test"); + + @Test + public void testConstructor() { + MsoNetworkAlreadyExists msoNetworkAlreadyExists = new MsoNetworkAlreadyExists("test","test","test"); + Assert.assertEquals("Stack test already exists in Tenant test in Cloud test",msoNetworkAlreadyExists.getMessage()); + Assert.assertEquals("409 Conflict: Stack test already exists in Tenant test in Cloud test",msoNetworkAlreadyExists.toString()); + } + } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoNetworkNotFoundTest.java index ea74efcf42..5991e55915 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoNetworkNotFoundTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,8 +18,18 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; + +import org.junit.Test; +import org.junit.Assert; public class MsoNetworkNotFoundTest { - MsoNetworkNotFound msoNetworkNotFound =new MsoNetworkNotFound("test","test","test"); + + @Test + public void testConstructor() { + MsoNetworkNotFound msoNetworkNotFound =new MsoNetworkNotFound("test","test","test"); + Assert.assertEquals("Network test does not exist in Cloud/Tenant test/test",msoNetworkNotFound.getMessage()); + Assert.assertEquals("404 Not Found: Network test does not exist in Cloud/Tenant test/test",msoNetworkNotFound.toString()); + } + } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoOpenstackExceptionTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoOpenstackExceptionTest.java new file mode 100644 index 0000000000..7bdb2283e8 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoOpenstackExceptionTest.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.openstack.exceptions; + +import org.junit.Test; +import org.junit.Assert; + +public class MsoOpenstackExceptionTest { + + @Test + public void testConstructor() { + MsoOpenstackException msoOpenstackException= new MsoOpenstackException(404,"test","test"); + Assert.assertEquals("test",msoOpenstackException.getMessage()); + Assert.assertEquals("404 test: test",msoOpenstackException.toString()); + Assert.assertEquals(MsoExceptionCategory.OPENSTACK, msoOpenstackException.category); + } + + @Test + public void testOverloadedConstructor() { + MsoOpenstackException msoOpenstackExceptionEx= new MsoOpenstackException(404,"test","test",new Exception()); + Assert.assertEquals("test",msoOpenstackExceptionEx.getMessage()); + Assert.assertEquals("404 test: test",msoOpenstackExceptionEx.toString()); + Assert.assertEquals(MsoExceptionCategory.OPENSTACK, msoOpenstackExceptionEx.category); + Assert.assertNotNull(msoOpenstackExceptionEx.getCause()); + + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoStackAlreadyExistsTest.java index f36ddfe7a1..4b44f0db93 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoStackAlreadyExistsTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,8 +18,17 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; + +import org.junit.Assert; +import org.junit.Test; public class MsoStackAlreadyExistsTest { - MsoStackAlreadyExists msoStackAlreadyExists = new MsoStackAlreadyExists("test","test","test"); + + @Test + public void testConstructor() { + MsoStackAlreadyExists msoStackAlreadyExists = new MsoStackAlreadyExists("test", "test", "test"); + Assert.assertEquals("Stack test already exists in Tenant test in Cloud test",msoStackAlreadyExists.getMessage()); + Assert.assertEquals("409 Conflict: Stack test already exists in Tenant test in Cloud test",msoStackAlreadyExists.toString()); + } } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoStackNotFoundTest.java index e422c04fcc..8ce5a33cc4 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoStackNotFoundTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,8 +18,17 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; + +import org.junit.Assert; +import org.junit.Test; public class MsoStackNotFoundTest { - MsoStackNotFound msoStackNotFound = new MsoStackNotFound("test","test","test"); + + @Test + public void testConstructor() { + MsoStackNotFound msoStackNotFound = new MsoStackNotFound("test", "test", "test"); + Assert.assertEquals("Stack test does not exist in Cloud/Tenant test/test",msoStackNotFound.getMessage()); + Assert.assertEquals("404 Not Found: Stack test does not exist in Cloud/Tenant test/test",msoStackNotFound.toString()); + } } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoTenantAlreadyExistsTest.java index d9e83063d1..5999a587a5 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoTenantAlreadyExistsTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,8 +18,17 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; + +import org.junit.Assert; +import org.junit.Test; public class MsoTenantAlreadyExistsTest { - MsoTenantAlreadyExists msoTenantAlreadyExists = new MsoTenantAlreadyExists("test","test"); + + @Test + public void testConstructor() { + MsoTenantAlreadyExists msoTenantAlreadyExists = new MsoTenantAlreadyExists("test","test"); + Assert.assertEquals("Tenant test already exists in Cloud test",msoTenantAlreadyExists.getMessage()); + Assert.assertEquals("409 Conflict: Tenant test already exists in Cloud test",msoTenantAlreadyExists.toString()); + } } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoTenantNotFoundTest.java index a8dd6c6afb..23df616573 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoTenantNotFoundTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,8 +18,18 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.openstack.exceptions; +package org.onap.so.openstack.exceptions; + +import org.junit.Assert; +import org.junit.Test; public class MsoTenantNotFoundTest { - MsoTenantNotFound msoTenantNotFound = new MsoTenantNotFound("test","test"); + + @Test + public void testConstructor() { + MsoTenantNotFound msoTenantNotFound = new MsoTenantNotFound("test","test"); + Assert.assertEquals("Tenant test does not exist in Cloud test",msoTenantNotFound.getMessage()); + Assert.assertEquals("404 Not Found: Tenant test does not exist in Cloud test",msoTenantNotFound.toString()); + } + } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/NetworkInfoMapperTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/NetworkInfoMapperTest.java new file mode 100644 index 0000000000..90e15f8ba5 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/NetworkInfoMapperTest.java @@ -0,0 +1,124 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.openstack.mappers; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +import org.javatuples.Pair; +import org.junit.Test; +import org.onap.so.openstack.beans.NetworkInfo; +import org.onap.so.openstack.beans.NetworkStatus; + +import com.woorea.openstack.quantum.model.Network; +import com.woorea.openstack.quantum.model.Segment; + +public class NetworkInfoMapperTest { + + @Test + public void checkNetworkStatusMap() { + NetworkInfoMapper mapper = new NetworkInfoMapper(new Network()); + assertEquals(NetworkStatus.ACTIVE, mapper.mapStatus("ACTIVE")); + assertEquals(NetworkStatus.BUILD, mapper.mapStatus("BUILD")); + assertEquals(NetworkStatus.ERROR, mapper.mapStatus("ERROR")); + assertEquals(NetworkStatus.DOWN, mapper.mapStatus("DOWN")); + assertEquals(NetworkStatus.UNKNOWN, mapper.mapStatus("NOT IN MAP")); + assertEquals(NetworkStatus.UNKNOWN, mapper.mapStatus(null)); + } + + @Test + public void checkLocateVlanInformationNoSegments() { + Network network = new Network(); + network.setProviderPhysicalNetwork("test-physical-network"); + network.setProviderNetworkType("vlan"); + network.setProviderSegmentationId(2); + NetworkInfoMapper mapper = new NetworkInfoMapper(network); + NetworkInfo result = mapper.map(); + assertEquals("test-physical-network", result.getProvider()); + assertEquals(1, result.getVlans().size()); + assertEquals(2, result.getVlans().get(0).intValue()); + } + + @Test + public void checkLocateVlanInformationSegments() { + Network network = new Network(); + addSegments(network); + + NetworkInfoMapper mapper = new NetworkInfoMapper(network); + NetworkInfo result = mapper.map(); + assertEquals("type1", result.getProvider()); + assertEquals(2, result.getVlans().size()); + assertEquals(Arrays.asList(1, 2).toString(), result.getVlans().toString()); + } + + @Test + public void checkLocateVlanInformationSegmentsAndPhysical() { + Network network = new Network(); + addSegments(network); + network.setProviderPhysicalNetwork("test-physical-network"); + network.setProviderNetworkType("vlan"); + network.setProviderSegmentationId(2); + NetworkInfoMapper mapper = new NetworkInfoMapper(network); + NetworkInfo result = mapper.map(); + assertEquals("test-physical-network", result.getProvider()); + assertEquals(1, result.getVlans().size()); + assertEquals(2, result.getVlans().get(0).intValue()); + } + + @Test + public void nullNetwork() { + NetworkInfoMapper mapper = new NetworkInfoMapper(null); + assertEquals(NetworkStatus.NOTFOUND, mapper.map().getStatus()); + } + + @Test + public void mapFields() { + Network network = new Network(); + network.setId("id"); + network.setName("name"); + network.setSubnets(Arrays.asList("string1", "string2")); + NetworkInfoMapper mapper = new NetworkInfoMapper(network); + NetworkInfo mapped = mapper.map(); + assertEquals("name", mapped.getName()); + assertEquals("id", mapped.getId()); + assertEquals(network.getSubnets(), mapped.getSubnets()); + } + + private Network addSegments(Network network) { + List<Segment> segments = new ArrayList<>(); + Segment segment1 = new Segment(); + segment1.setProviderPhysicalNetwork("type1"); + segment1.setProviderNetworkType("vlan"); + segment1.setProviderSegmentationId(1); + segments.add(segment1); + Segment segment2 = new Segment(); + segment2.setProviderPhysicalNetwork("type2"); + segment2.setProviderNetworkType("vlan"); + segment2.setProviderSegmentationId(2); + segments.add(segment2); + network.setSegments(segments); + return network; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/StackInfoMapperTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/StackInfoMapperTest.java new file mode 100644 index 0000000000..f01745f8c1 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/StackInfoMapperTest.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.openstack.mappers; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.onap.so.openstack.beans.HeatStatus; +import org.onap.so.openstack.beans.StackInfo; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.woorea.openstack.heat.model.Stack; + +public class StackInfoMapperTest { + + private static final String PATH = "src/test/resources/"; + @Test + public void nullStack() { + StackInfoMapper mapper = new StackInfoMapper(null); + assertEquals(HeatStatus.NOTFOUND, mapper.map().getStatus()); + } + + @Test + public void checkHeatStatusMap() { + StackInfoMapper mapper = new StackInfoMapper(null); + assertEquals(HeatStatus.BUILDING, mapper.mapStatus("CREATE_IN_PROGRESS")); + assertEquals(HeatStatus.CREATED, mapper.mapStatus("CREATE_COMPLETE")); + assertEquals(HeatStatus.FAILED, mapper.mapStatus("CREATE_FAILED")); + assertEquals(HeatStatus.DELETING, mapper.mapStatus("DELETE_IN_PROGRESS")); + assertEquals(HeatStatus.NOTFOUND, mapper.mapStatus("DELETE_COMPLETE")); + assertEquals(HeatStatus.FAILED, mapper.mapStatus("DELETE_FAILED")); + assertEquals(HeatStatus.UPDATING, mapper.mapStatus("UPDATE_IN_PROGRESS")); + assertEquals(HeatStatus.FAILED, mapper.mapStatus("UPDATE_FAILED")); + assertEquals(HeatStatus.UPDATED, mapper.mapStatus("UPDATE_COMPLETE")); + assertEquals(HeatStatus.INIT, mapper.mapStatus(null)); + assertEquals(HeatStatus.UNKNOWN, mapper.mapStatus("status-not-there")); + } + + @Test + public void checkOutputToMap() throws JsonParseException, JsonMappingException, IOException { + ObjectMapper jacksonMapper = new ObjectMapper(); + Stack sample = jacksonMapper.readValue(this.getJson("stack-example.json"), Stack.class); + StackInfoMapper mapper = new StackInfoMapper(sample); + StackInfo result = mapper.map(); + Map<String, Object> map = result.getOutputs(); + assertEquals(true, map.containsKey("key2")); + assertEquals("value1", map.get("key1")); + } + + @Test + public void mapRemainingFields() { + Stack stack = new Stack(); + stack.setStackName("name"); + stack.setId("id"); + stack.setStackStatusReason("message"); + stack.setParameters(new HashMap<String, Object>()); + StackInfoMapper mapper = new StackInfoMapper(stack); + StackInfo info = mapper.map(); + assertEquals("name", info.getName()); + assertEquals("name/id", info.getCanonicalName()); + assertEquals("message", info.getStatusMessage()); + assertEquals(stack.getParameters(), info.getParameters()); + } + + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get(PATH + filename))); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java deleted file mode 100644 index 9efaee921f..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java +++ /dev/null @@ -1,452 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.adapters; - -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import org.junit.Test; -import org.openecomp.mso.adapters.nwrest.ContrailNetwork; -import org.openecomp.mso.adapters.nwrest.CreateNetworkError; -import org.openecomp.mso.adapters.nwrest.CreateNetworkRequest; -import org.openecomp.mso.adapters.nwrest.CreateNetworkResponse; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkError; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkRequest; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkResponse; -import org.openecomp.mso.adapters.nwrest.NetworkExceptionResponse; -import org.openecomp.mso.adapters.nwrest.NetworkTechnology; -import org.openecomp.mso.adapters.nwrest.ProviderVlanNetwork; -import org.openecomp.mso.adapters.nwrest.QueryNetworkResponse; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkError; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkRequest; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkResponse; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkError; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkRequest; -import org.openecomp.mso.adapters.tenantrest.CreateTenantError; -import org.openecomp.mso.adapters.tenantrest.CreateTenantRequest; -import org.openecomp.mso.adapters.tenantrest.CreateTenantResponse; -import org.openecomp.mso.adapters.tenantrest.DeleteTenantError; -import org.openecomp.mso.adapters.tenantrest.DeleteTenantRequest; -import org.openecomp.mso.adapters.tenantrest.DeleteTenantResponse; -import org.openecomp.mso.adapters.tenantrest.HealthCheckHandler; -import org.openecomp.mso.adapters.tenantrest.QueryTenantError; -import org.openecomp.mso.adapters.tenantrest.QueryTenantResponse; -import org.openecomp.mso.adapters.tenantrest.RollbackTenantError; -import org.openecomp.mso.adapters.tenantrest.RollbackTenantRequest; -import org.openecomp.mso.adapters.tenantrest.RollbackTenantResponse; -import org.openecomp.mso.adapters.tenantrest.TenantExceptionResponse; -import org.openecomp.mso.adapters.tenantrest.TenantRollback; -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.CreateVolumeGroupRequest; -import org.openecomp.mso.adapters.vnfrest.CreateVolumeGroupResponse; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.DeleteVolumeGroupRequest; -import org.openecomp.mso.adapters.vnfrest.DeleteVolumeGroupResponse; -import org.openecomp.mso.adapters.vnfrest.QueryVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.QueryVolumeGroupResponse; -import org.openecomp.mso.adapters.vnfrest.RollbackVolumeGroupResponse; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.UpdateVolumeGroupRequest; -import org.openecomp.mso.adapters.vnfrest.UpdateVolumeGroupResponse; -import org.openecomp.mso.adapters.vnfrest.VfModuleExceptionResponse; -import org.openecomp.mso.adapters.vnfrest.VfModuleRollback; -import org.openecomp.mso.adapters.vnfrest.VolumeGroupRollback; -import org.openecomp.mso.entity.MsoRequest; - -public class BeanTest { - - // Test cases for code coverage - @Test - public void testCreateNetworkRequest() { - CreateNetworkRequest n = new CreateNetworkRequest(); - n.setBackout(true); - n.setCloudSiteId("test"); - ContrailNetwork contrailNetwork = new ContrailNetwork("shared", "external", new ArrayList<>(), - new ArrayList<>(), new ArrayList<>()); - contrailNetwork.setExternal("dgddb"); - contrailNetwork.setPolicyFqdns(new ArrayList<>()); - contrailNetwork.setRouteTableFqdns(new ArrayList<>()); - contrailNetwork.setRouteTargets(new ArrayList<>()); - contrailNetwork.setShared("test"); - n.setContrailNetwork(contrailNetwork); - n.setFailIfExists(true); - n.setMessageId("38829"); - n.setModelCustomizationUuid("4u838282"); - MsoRequest req = new MsoRequest(); - req.setRequestId("38849"); - req.setServiceInstanceId("3884839"); - n.setMsoRequest(req); - n.setNetworkId("478383"); - n.setNetworkName("tetet"); - n.setNetworkParams(new HashMap<>()); - n.setNetworkTechnology("VMWARE"); - n.setNetworkType("tete"); - n.setNetworkTypeVersion("v1"); - n.setNotificationUrl("test"); - ProviderVlanNetwork providerVlanNetwork = new ProviderVlanNetwork("test", new ArrayList<>()); - providerVlanNetwork.setPhysicalNetworkName("physicalNetworkName"); - providerVlanNetwork.setVlans(new ArrayList<>()); - n.setProviderVlanNetwork(providerVlanNetwork); - n.setSkipAAI(false); - n.setSubnets(new ArrayList<>()); - n.setTenantId("tenantId"); - n.getBackout(); - n.getCloudSiteId(); - ContrailNetwork cn = n.getContrailNetwork(); - cn.getExternal(); - cn.getPolicyFqdns(); - cn.getRouteTableFqdns(); - cn.getRouteTargets(); - cn.getShared(); - n.getFailIfExists(); - n.getMessageId(); - n.getModelCustomizationUuid(); - n.getMsoRequest(); - n.getNetworkId(); - n.getNetworkName(); - n.getNetworkParams(); - n.getNetworkTechnology(); - n.getNetworkType(); - n.getNetworkTypeVersion(); - n.getNotificationUrl(); - n.getProviderVlanNetwork(); - n.getSkipAAI(); - n.getSubnets(); - n.getTenantId(); - n.isContrailRequest(); - n.isSynchronous(); - n.toJsonString(); - n.toXmlString(); - } - - @Test - public void testDeleteNetworkRequest() { - DeleteNetworkRequest r = new DeleteNetworkRequest(); - r.setCloudSiteId("test"); - r.setMessageId("messageId"); - r.setModelCustomizationUuid("modelCustomizationUuid"); - r.setMsoRequest(null); - r.setNetworkId("networkId"); - r.setNetworkStackId("networkStackId"); - r.setNetworkType("networkType"); - r.setNotificationUrl("notificationUrl"); - r.setSkipAAI(true); - r.setTenantId("tenantId"); - r.getCloudSiteId(); - r.getMessageId(); - r.getModelCustomizationUuid(); - r.getMsoRequest(); - r.getNetworkId(); - r.getNetworkStackId(); - r.getNetworkType(); - r.getNotificationUrl(); - r.getSkipAAI(); - r.getTenantId(); - } - - @Test - public void testCreateNetworkError() { - CreateNetworkError e = new CreateNetworkError("message"); - e = new CreateNetworkError("message", null, true, "messageid"); - DeleteNetworkError d = new DeleteNetworkError("message"); - d = new DeleteNetworkError("message", null, false, "29102"); - } - - @Test - public void testCreatenetworkResponse() { - CreateNetworkResponse cnr = new CreateNetworkResponse("networkId", "neutronNetworkId", "networkStackId", - "networkFqdn", false, null, null, "messageId"); - cnr.setMessageId("messageId"); - cnr.setNetworkCreated(true); - cnr.setNetworkFqdn(null); - cnr.setNetworkStackId(null); - cnr.setNeutronNetworkId(null); - cnr.setRollback(null); - cnr.setNetworkStackId(null); - cnr.setSubnetMap(null); - cnr.getMessageId(); - cnr.getNetworkCreated(); - cnr.getNetworkFqdn(); - cnr.getNetworkId(); - cnr.getNetworkStackId(); - cnr.getNeutronNetworkId(); - cnr.getRollback(); - cnr.getSubnetMap(); - - DeleteNetworkResponse dr = new DeleteNetworkResponse("networkId", true, "messageId"); - dr.setMessageId(null); - dr.setNetworkDeleted(null); - dr.setNetworkId(null); - dr.getMessageId(); - dr.getNetworkDeleted(); - dr.getNetworkId(); - - NetworkExceptionResponse ner = new NetworkExceptionResponse("message"); - ner = new NetworkExceptionResponse(null, null, false, null); - ner.setCategory(null); - ner.setMessage(null); - ner.setRolledBack(null); - ner.setMessageId(null); - ner.getCategory(); - ner.getMessage(); - ner.getMessageId(); - ner.getRolledBack(); - - ner.toJsonString(); - ner.toXmlString(); - NetworkTechnology nt = NetworkTechnology.NEUTRON; - ProviderVlanNetwork pvn = new ProviderVlanNetwork(null, null); - pvn.setPhysicalNetworkName(null); - pvn.setVlans(null); - pvn.getPhysicalNetworkName(); - pvn.getVlans(); - - QueryNetworkResponse qnr = new QueryNetworkResponse(null, null, null, null, null); - qnr.setNetworkExists(null); - qnr.setNetworkId(null); - qnr.setNetworkOutputs(null); - qnr.setNetworkStackId(null); - qnr.setNetworkStatus(null); - qnr.setNeutronNetworkId(null); - qnr.setRouteTargets(null); - qnr.setSubnetIdMap(null); - qnr.setVlans(null); - qnr.getNetworkExists(); - qnr.getNetworkId(); - qnr.getNetworkOutputs(); - qnr.getNetworkStatus(); - qnr.getNeutronNetworkId(); - qnr.getRouteTargets(); - qnr.getSubnetIdMap(); - qnr.getVlans(); - qnr.toJsonString(); - - UpdateNetworkRequest unr = new UpdateNetworkRequest(); - unr.setBackout(null); - unr.setCloudSiteId(null); - unr.setContrailNetwork(null); - unr.setMessageId(null); - unr.setModelCustomizationUuid(null); - unr.setMsoRequest(null); - unr.setNetworkId(null); - unr.setNetworkName(null); - unr.setNetworkParams(null); - unr.setNetworkStackId(null); - unr.setNetworkTechnology("VMWARE"); - unr.setNetworkType(null); - unr.setNetworkTypeVersion(null); - unr.setNotificationUrl(null); - unr.setProviderVlanNetwork(null); - unr.setSkipAAI(null); - unr.setSubnets(null); - unr.setTenantId(null); - unr.getBackout(); - unr.getCloudSiteId(); - unr.getContrailNetwork(); - unr.getMessageId(); - unr.getModelCustomizationUuid(); - unr.getMsoRequest(); - unr.getNetworkId(); - unr.getNetworkName(); - unr.getNetworkParams(); - unr.getNetworkStackId(); - unr.getNetworkTechnology(); - unr.getNetworkType(); - unr.getNetworkTypeVersion(); - unr.getNotificationUrl(); - unr.getProviderVlanNetwork(); - unr.getSkipAAI(); - unr.getSubnets(); - unr.getTenantId(); - unr.isContrailRequest(); - - RollbackNetworkError err = new RollbackNetworkError("message"); - err = new RollbackNetworkError(null, null, false, null); - RollbackNetworkRequest req = new RollbackNetworkRequest(); - req.setNetworkRollback(null); - req.getNetworkRollback(); - req.setMessageId(null); - req.getMessageId(); - req.setNotificationUrl(null); - req.getNotificationUrl(); - req.setSkipAAI(null); - req.getSkipAAI(); - - RollbackNetworkResponse rnr = new RollbackNetworkResponse(true, null); - rnr.setMessageId(null); - rnr.getMessageId(); - rnr.setNetworkRolledBack(null); - rnr.getNetworkRolledBack(); - - UpdateNetworkError error = new UpdateNetworkError(null); - error = new UpdateNetworkError("test", null, false, null); - - UpdateVfModuleRequest uvmr = new UpdateVfModuleRequest(); - uvmr.setBackout(null); - uvmr.setBaseVfModuleId(null); - uvmr.setBaseVfModuleStackId(null); - uvmr.setFailIfExists(null); - uvmr.setMessageId(null); - uvmr.setModelCustomizationUuid(null); - uvmr.setMsoRequest(null); - uvmr.setNotificationUrl(null); - uvmr.setRequestType(null); - uvmr.setSkipAAI(true); - uvmr.setTenantId(null); - uvmr.setVfModuleId(null); - uvmr.setVfModuleName(null); - uvmr.setVfModuleParams(null); - uvmr.setVfModuleStackId(null); - uvmr.setVfModuleType(null); - uvmr.setVnfId(null); - uvmr.setVnfType(null); - uvmr.setVnfVersion(null); - uvmr.setVolumeGroupId(null); - uvmr.setVolumeGroupStackId(null); - uvmr.getBackout(); - uvmr.getBaseVfModuleId(); - uvmr.getBaseVfModuleStackId(); - uvmr.getCloudSiteId(); - uvmr.getFailIfExists(); - uvmr.getMessageId(); - uvmr.getModelCustomizationUuid(); - uvmr.getMsoRequest(); - uvmr.getNotificationUrl(); - uvmr.getRequestType(); - uvmr.getSkipAAI(); - uvmr.getTenantId(); - uvmr.getVfModuleId(); - uvmr.getVfModuleName(); - uvmr.getVfModuleParams(); - uvmr.getVfModuleStackId(); - uvmr.getVfModuleType(); - uvmr.getVnfId(); - uvmr.getVnfType(); - uvmr.getVnfVersion(); - uvmr.getVolumeGroupId(); - uvmr.getVolumeGroupStackId(); - uvmr.setCloudSiteId(null); - - CreateVfModuleRequest cvmr = new CreateVfModuleRequest(); - cvmr.setBackout(null); - cvmr.setBaseVfModuleId(null); - cvmr.setBaseVfModuleStackId(null); - cvmr.setCloudSiteId(null); - cvmr.setFailIfExists(null); - - coverCode(CreateVfModuleRequest.class); - CreateVfModuleResponse resp = new CreateVfModuleResponse(null, null, null, true, null, null, null); - resp.toJsonString(); - resp.toXmlString(); - coverCode(CreateVfModuleResponse.class); - - coverCode(CreateVolumeGroupRequest.class); - - CreateVolumeGroupResponse cvgr = new CreateVolumeGroupResponse(null, null, true, null, null, null); - coverCode(CreateVolumeGroupResponse.class); - coverCode(DeleteVfModuleRequest.class); - coverCode(DeleteVfModuleResponse.class); - coverCode(DeleteVolumeGroupRequest.class); - coverCode(DeleteVolumeGroupResponse.class); - QueryVfModuleResponse vfmr = new QueryVfModuleResponse(null, null, null, null, null); - coverCode(QueryVfModuleResponse.class); - QueryVolumeGroupResponse qvgr = new QueryVolumeGroupResponse(null, null, null, null); - coverCode(QueryVolumeGroupResponse.class); - UpdateVfModuleResponse uvfmr = new UpdateVfModuleResponse(null, null, null, null, null); - coverCode(UpdateVfModuleResponse.class); - coverCode(UpdateVolumeGroupRequest.class); - UpdateVolumeGroupResponse uvgr = new UpdateVolumeGroupResponse(null, null, null, null); - coverCode(UpdateVolumeGroupResponse.class); - VfModuleExceptionResponse vfmer = new VfModuleExceptionResponse(null, null, false, null); - coverCode(VfModuleExceptionResponse.class); - //VfModuleRollback vfmrb = new VfModuleRollback(null, null, null, null); - VfModuleRollback vfmrb = new VfModuleRollback(null, null, null, false, null, null, null, null); - coverCode(VfModuleRollback.class); - //VolumeGroupRollback vgrback = new VolumeGroupRollback(null, null, null); - VolumeGroupRollback vgrback = new VolumeGroupRollback(null, null, false, null, null, null, null); - coverCode(VolumeGroupRollback.class); - RollbackVolumeGroupResponse rvgresp = new RollbackVolumeGroupResponse(null, null); - coverCode(RollbackVolumeGroupResponse.class); - } - - @Test - public void testTenantRestPackage(){ - CreateTenantError cte = new CreateTenantError(null, null, false); - coverCode(CreateTenantError.class); - CreateTenantRequest ctreq = new CreateTenantRequest(); - ctreq.toJsonString(); - ctreq.toXmlString(); - ctreq.toString(); - coverCode(CreateTenantRequest.class); - CreateTenantResponse ctresp = new CreateTenantResponse(null, null, null, new TenantRollback()); - ctresp.toString(); - coverCode(CreateTenantResponse.class); - DeleteTenantError dterr = new DeleteTenantError(null, null, false); - coverCode(DeleteTenantError.class); - coverCode(DeleteTenantRequest.class); - coverCode(DeleteTenantResponse.class); - coverCode(HealthCheckHandler.class); - QueryTenantError qnerr = new QueryTenantError(null, null); - coverCode(QueryTenantError.class); - QueryTenantResponse qtresp = new QueryTenantResponse(null, null, null); - coverCode(QueryTenantResponse.class); - coverCode(RollbackTenantError.class); - RollbackTenantError rollTer = new RollbackTenantError(null, null, false); - coverCode(RollbackTenantRequest.class); - coverCode(RollbackTenantResponse.class); - TenantExceptionResponse resp = new TenantExceptionResponse(null, null, false); - coverCode(TenantExceptionResponse.class); - coverCode(TenantRollback.class); - } - - private void coverCode(Class cls) { - try { - Object obj = cls.newInstance(); - Method[] methods = cls.getDeclaredMethods(); - for (Method m : methods) { - try { - m.setAccessible(true); - Type[] types = m.getGenericParameterTypes(); - Object[] objs = { new Object(), new Object(), new Object(), new Object() }; - if (types.length < 1) { - m.invoke(obj); - } else if (types.length == 1) { - String type = types[0].getTypeName(); - if (type.contains("<")) { - type = type.substring(0, type.indexOf("<")); - } - Class paramCls = Class.forName(type); - Object paramobj = paramCls.newInstance(); - m.invoke(obj, paramobj); - } else if (types.length == 2) { - // m.invoke(obj,null,null); - } - } catch (Exception ex) { - } - } - } catch (Exception ex) { - ex.printStackTrace(); - } - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java deleted file mode 100644 index fd0855e221..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.json; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - -import java.util.Map; -import org.codehaus.jackson.JsonParser; -import org.codehaus.jackson.map.DeserializationContext; -import org.codehaus.jackson.map.ObjectMapper; -import org.json.JSONException; -import org.json.JSONObject; -import org.junit.Test; - -public class MapDeserializerTest { - - private static final String MAP_KEY = "keyTest"; - private static final String MAP_VALUE = "valueTest"; - - @Test - public void mapWithProperValuesIsReturned() throws Exception { - JsonParser parser = new ObjectMapper().getJsonFactory().createJsonParser(getJsonAsString()); - MapDeserializer testedObject = new MapDeserializer(); - Map<String, String> params = testedObject.deserialize(parser, mock(DeserializationContext.class)); - assertThat(params).hasSize(1).containsEntry(MAP_KEY, MAP_VALUE); - } - - private String getJsonAsString() throws JSONException { - JSONObject child2 = new JSONObject(); - child2.put("key", MAP_KEY); - child2.put("value", MAP_VALUE); - JSONObject child1 = new JSONObject(); - child1.put("child2", child2); - JSONObject parent = new JSONObject(); - parent.put("child1", child1); - return parent.toString(); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapSerializerTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapSerializerTest.java deleted file mode 100644 index f903f21441..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapSerializerTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.json; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -import java.util.HashMap; -import java.util.Map; -import org.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.map.SerializerProvider; -import org.junit.Test; - -public class MapSerializerTest { - - private static final String JSON_FIELD_NAME_1 = "testKey1"; - private static final String JSON_VALUE_1 = "testValue1"; - private static final String JSON_FIELD_NAME_2 = "testKey2"; - private static final String JSON_VALUE_2 = "testValue2"; - - @Test - public void serializationWritesTheProperFieldsToJson() throws Exception { - JsonGenerator jsonGeneratorMock = mock(JsonGenerator.class); - MapSerializer testedObject = new MapSerializer(); - testedObject.serialize(prepareMap(), jsonGeneratorMock, mock(SerializerProvider.class)); - verify(jsonGeneratorMock).writeStringField("key", JSON_FIELD_NAME_1); - verify(jsonGeneratorMock).writeStringField("value", JSON_VALUE_1); - verify(jsonGeneratorMock).writeStringField("key", JSON_FIELD_NAME_2); - verify(jsonGeneratorMock).writeStringField("value", JSON_VALUE_2); - } - - private Map<String, String> prepareMap() { - Map<String, String> map = new HashMap<>(); - map.put(JSON_FIELD_NAME_1, JSON_VALUE_1); - map.put(JSON_FIELD_NAME_2, JSON_VALUE_2); - return map; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/RequestInformationTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/RequestInformationTest.java deleted file mode 100644 index c6d815a960..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/RequestInformationTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 TechMahindra - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdncrest; - -import org.junit.Assert; - -import org.junit.Before; -import org.junit.Test; - -public class RequestInformationTest { - - private RequestInformation requestInformation; - - @Before - public void setUp() { - requestInformation = new RequestInformation(); - } - - @Test - public void testGetRequestId() { - requestInformation.setRequestId("requestId"); - Assert.assertNotNull(requestInformation.getRequestId()); - Assert.assertEquals(requestInformation.getRequestId(), "requestId"); - } - - @Test - public void testGetSource() { - requestInformation.setSource("source"); - Assert.assertNotNull(requestInformation.getSource()); - Assert.assertEquals(requestInformation.getSource(), "source"); - } - - @Test - public void testGetNotificationUrl() { - requestInformation.setNotificationUrl("notificationUrl"); - Assert.assertNotNull(requestInformation.getNotificationUrl()); - Assert.assertEquals(requestInformation.getNotificationUrl(), "notificationUrl"); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCEventTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCEventTest.java deleted file mode 100644 index 81d888bf70..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCEventTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 TechMahindra - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdncrest; - -import static org.junit.Assert.*; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import java.util.HashMap; -import java.util.Map; - -public class SDNCEventTest { - - private SDNCEvent sdncEvent; - private Map<String, String> param; - private String name = "name"; - private String value = "value"; - - @Before - public void setUp() { - sdncEvent = new SDNCEvent(); - } - - @Test - public void testGetEventType() { - sdncEvent.setEventType("eventType"); - Assert.assertNotNull(sdncEvent.getEventType()); - Assert.assertEquals(sdncEvent.getEventType(), "eventType"); - } - - @Test - public void testGetEventCorrelatorType() { - sdncEvent.setEventCorrelatorType("eventCorrelatorType"); - Assert.assertNotNull(sdncEvent.getEventCorrelatorType()); - Assert.assertEquals(sdncEvent.getEventCorrelatorType(), "eventCorrelatorType"); - } - - @Test - public void testGetEventCorrelator() { - sdncEvent.setEventCorrelator("eventCorrelator"); - Assert.assertNotNull(sdncEvent.getEventCorrelator()); - Assert.assertEquals(sdncEvent.getEventCorrelator(), "eventCorrelator"); - } - - @Test - public void testGetParams() { - param = new HashMap<>(); - param.put("paramKey", "paramValue"); - sdncEvent.setParams(param); - Assert.assertNotNull(sdncEvent.getParams()); - Assert.assertTrue(sdncEvent.getParams().containsKey("paramKey")); - Assert.assertTrue(sdncEvent.getParams().containsValue("paramValue")); - } - - @Test - public void testAddParam() { - sdncEvent.addParam("name", "value"); - - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorTest.java deleted file mode 100644 index df69b377ca..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ============LICENSE_END========================================================= -*/ - -package org.openecomp.mso.adapters.sdncrest; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon; -import org.openecomp.mso.adapters.sdncrest.SDNCServiceError; - -public class SDNCServiceErrorTest { - - @Mock - SDNCErrorCommon sec; - - @InjectMocks - SDNCServiceError ssc; - - @Before - public void init(){ - MockitoAnnotations.initMocks(this); - } - - @Test - public void testSDNCServiceError() { - - ssc= new SDNCServiceError("id", "200", - "msg", "indicator"); - assert(ssc!=null); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestTest.java deleted file mode 100644 index c63f1b8f82..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ============LICENSE_END========================================================= -*/ - -package org.openecomp.mso.adapters.sdncrest; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.openecomp.mso.adapters.sdncrest.SDNCRequestCommon; -import org.openecomp.mso.adapters.sdncrest.ServiceInformation; -import org.openecomp.mso.adapters.sdncrest.RequestInformation; - -public class SDNCServiceRequestTest { - - @Mock - SDNCRequestCommon src; - - @Mock - ServiceInformation si; - - @Mock - RequestInformation ri; - - @InjectMocks - SDNCServiceRequest ssr; - - @Before - public void init(){ - MockitoAnnotations.initMocks(this); - } - - @Test - public void test() { - ssr= new SDNCServiceRequest("url", "timeout", - "sdncRequestId", "sdncService", "sdncOperation", - ri, - si, "sdncServiceDataType", - "sndcServiceData"); - - ssr.setSDNCService("sdncService"); - ssr.setSDNCServiceData("sndcServiceData"); - ssr.setSDNCServiceDataType("sdncServiceDataType"); - ssr.setBPTimeout("timeout"); - ssr.setBPNotificationUrl("url"); - ssr.setRequestInformation(ri); - ssr.setServiceInformation(si); - ssr.setSDNCOperation("sdncOperation"); - ssr.setSDNCRequestId("sdncRequestId"); - assert(ssr.getSDNCService().equals("sdncService")); - assert(ssr.getSDNCServiceData().equals("sndcServiceData")); - assert(ssr.getSDNCServiceDataType().equals("sdncServiceDataType")); - assert(ssr.getBPTimeout().equals("timeout")); - assert(ssr.getBPNotificationUrl().equals("url")); - assert(ssr.getRequestInformation().equals(ri)); - assert(ssr.getServiceInformation().equals(si)); - assert(ssr.getSDNCOperation().equals("sdncOperation")); - assert(ssr.getSDNCRequestId().equals("sdncRequestId")); - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseTest.java deleted file mode 100644 index 9c4e98a02b..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ============LICENSE_END========================================================= -*/ - -package org.openecomp.mso.adapters.sdncrest; - -import static org.junit.Assert.*; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon; - -public class SDNCServiceResponseTest { - - @Mock - SDNCResponseCommon src; - - @InjectMocks - SDNCServiceResponse ssr; - - @Before - public void init(){ - MockitoAnnotations.initMocks(this); - } - - @Test - public void test() { - ssr=new SDNCServiceResponse("sdncRequestId", "200", - "msg", "indicator"); - Map<String, String> mp = new HashMap<>(); - mp.put("name", "value"); - ssr.setParams(mp); - assert(ssr.getParams().equals(mp)); - assertNotNull(ssr); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationTest.java deleted file mode 100644 index 2b87bbf101..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ============LICENSE_END========================================================= -*/ - -package org.openecomp.mso.adapters.sdncrest; - -import org.junit.Test; - -public class ServiceInformationTest { - - - - @Test - public void test() { - ServiceInformation si= new ServiceInformation("id","service","GlobalId","name"); - - si.setServiceInstanceId("id"); - si.setServiceType("service"); - si.setSubscriberGlobalId("GlobalId"); - si.setSubscriberName("name"); - assert(si.getServiceInstanceId().equals("id")); - assert(si.getServiceType().equals("service")); - assert(si.getSubscriberGlobalId().equals("GlobalId")); - assert(si.getSubscriberName().equals("name")); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java deleted file mode 100644 index ec0b917a3d..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.openstack.beans; - -import com.woorea.openstack.quantum.model.Network; -import org.junit.Test; - -import java.util.Arrays; - -public class NetworkInfoTest { - - NetworkInfo networkInfo = new NetworkInfo(new Network()); - - @Test - public void getName() throws Exception { - networkInfo.getName(); - } - - @Test - public void setName() throws Exception { - networkInfo.setName("test"); - } - - @Test - public void getId() throws Exception { - networkInfo.getId(); - } - - @Test - public void setId() throws Exception { - networkInfo.setId("test"); - } - - @Test - public void getStatus() throws Exception { - networkInfo.getStatus(); - } - - @Test - public void setStatus() throws Exception { - networkInfo.setStatus(null); - } - - @Test - public void getProvider() throws Exception { - networkInfo.getProvider(); - } - - @Test - public void setProvider() throws Exception { - networkInfo.setProvider("provider"); - } - - @Test - public void getVlans() throws Exception { - networkInfo.getVlans(); - } - - @Test - public void setVlans() throws Exception { - networkInfo.setVlans(Arrays.asList(10, 20, 30)); - } - - @Test - public void getSubnets() throws Exception { - networkInfo.getSubnets(); - } - -}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackTest.java deleted file mode 100644 index b6245f642f..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackTest.java +++ /dev/null @@ -1,151 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.openstack.beans; - -import org.junit.Test; -import org.openecomp.mso.entity.MsoRequest; - -import java.util.Arrays; - -public class NetworkRollbackTest { - - NetworkRollback networkRollback = new NetworkRollback(); - - @Test - public void getNetworkId() throws Exception { - networkRollback.getNetworkId(); - } - - @Test - public void setNetworkId() throws Exception { - networkRollback.setNetworkId("255.255.255.0"); - } - - @Test - public void getNeutronNetworkId() throws Exception { - networkRollback.getNeutronNetworkId(); - } - - @Test - public void setNeutronNetworkId() throws Exception { - networkRollback.setNeutronNetworkId("192.168.0.0"); - } - - @Test - public void getNetworkStackId() throws Exception { - networkRollback.getNetworkStackId(); - } - - @Test - public void setNetworkStackId() throws Exception { - networkRollback.setNetworkStackId("id-123"); - } - - @Test - public void getTenantId() throws Exception { - networkRollback.getTenantId(); - } - - @Test - public void setTenantId() throws Exception { - networkRollback.setTenantId("id-123"); - } - - @Test - public void getCloudId() throws Exception { - networkRollback.getCloudId(); - } - - @Test - public void setCloudId() throws Exception { - networkRollback.setCloudId("id-123"); - } - - @Test - public void getNetworkType() throws Exception { - networkRollback.getNetworkType(); - } - - @Test - public void setNetworkType() throws Exception { - networkRollback.setNetworkType("type"); - } - - @Test - public void getModelCustomizationUuid() throws Exception { - networkRollback.getModelCustomizationUuid(); - } - - @Test - public void setModelCustomizationUuid() throws Exception { - networkRollback.setModelCustomizationUuid("id-123"); - } - - @Test - public void getNetworkCreated() throws Exception { - networkRollback.getNetworkCreated(); - } - - @Test - public void setNetworkCreated() throws Exception { - networkRollback.setNetworkCreated(true); - } - - @Test - public void getNetworkName() throws Exception { - networkRollback.getNetworkName(); - } - - @Test - public void setNetworkName() throws Exception { - networkRollback.setNetworkName("test"); - } - - @Test - public void getPhysicalNetwork() throws Exception { - networkRollback.getPhysicalNetwork(); - } - - @Test - public void setPhysicalNetwork() throws Exception { - networkRollback.setPhysicalNetwork("test"); - } - - @Test - public void getVlans() throws Exception { - networkRollback.getVlans(); - } - - @Test - public void setVlans() throws Exception { - networkRollback.setVlans(Arrays.asList(10, 20)); - } - - @Test - public void getMsoRequest() throws Exception { - networkRollback.getMsoRequest(); - } - - @Test - public void setMsoRequest() throws Exception { - networkRollback.setMsoRequest(new MsoRequest()); - } - -}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java deleted file mode 100644 index b549b5f853..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.openstack.beans; - -import org.junit.Test; - -import java.util.HashMap; - -public class StackInfoTest { - - StackInfo stackInfo = new StackInfo(); - - @Test - public void getName() throws Exception { - stackInfo.getName(); - } - - @Test - public void setName() throws Exception { - stackInfo.setName("test"); - } - - @Test - public void getCanonicalName() throws Exception { - stackInfo.getCanonicalName(); - } - - @Test - public void setCanonicalName() throws Exception { - stackInfo.setCanonicalName("test"); - } - - @Test - public void getStatus() throws Exception { - stackInfo.getStatus(); - } - - @Test - public void setStatus() throws Exception { - stackInfo.setStatus(HeatStatus.BUILDING); - } - - @Test - public void getStatusMessage() throws Exception { - stackInfo.getStatusMessage(); - } - - @Test - public void setStatusMessage() throws Exception { - stackInfo.setStatusMessage("test"); - } - - @Test - public void getOutputs() throws Exception { - stackInfo.getOutputs(); - } - - @Test - public void setOutputs() throws Exception { - stackInfo.setOutputs(new HashMap<>()); - } - - @Test - public void getParameters() throws Exception { - stackInfo.getParameters(); - } - - @Test - public void setParameters() throws Exception { - stackInfo.setParameters(new HashMap<>()); - } - -}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/SubnetTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/SubnetTest.java deleted file mode 100644 index 42781c04d1..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/SubnetTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.openstack.beans; - -import org.junit.Test; - -import java.util.Arrays; -import java.util.Collections; - -public class SubnetTest { - - Subnet subnet = new Subnet(); - - @Test - public void getSubnetName() throws Exception { - subnet.getSubnetName(); - } - - @Test - public void setSubnetName() throws Exception { - subnet.setSubnetName("test"); - } - - @Test - public void getAllocationPools() throws Exception { - subnet.getAllocationPools(); - } - - @Test - public void getCidr() throws Exception { - subnet.getCidr(); - } - - @Test - public void getDnsNameServers() throws Exception { - subnet.getDnsNameServers(); - } - - @Test - public void getEnableDHCP() throws Exception { - subnet.getEnableDHCP(); - } - - @Test - public void getAddrFromStart() throws Exception { - subnet.getAddrFromStart(); - } - - @Test - public void setAddrFromStart() throws Exception { - subnet.setAddrFromStart(true); - } - - @Test - public void getGatewayIp() throws Exception { - subnet.getGatewayIp(); - } - - @Test - public void getHostRoutes() throws Exception { - subnet.getHostRoutes(); - } - - @Test - public void getNeutronId() throws Exception { - subnet.getNeutronId(); - } - - @Test - public void getIpVersion() throws Exception { - subnet.getIpVersion(); - } - - @Test - public void getSubnetId() throws Exception { - subnet.getSubnetId(); - } - - @Test - public void setAllocationPools() throws Exception { - subnet.setAllocationPools(Arrays.asList()); - } - - @Test - public void setCidr() throws Exception { - subnet.setCidr("255.255.255.0"); - } - - @Test - public void setDnsNameServers() throws Exception { - subnet.setDnsNameServers(Arrays.asList()); - } - - @Test - public void setEnableDHCP() throws Exception { - subnet.setEnableDHCP(true); - } - - @Test - public void setGatewayIp() throws Exception { - subnet.setGatewayIp("192.168.0.1"); - } - - @Test - public void setHostRoutes() throws Exception { - subnet.setHostRoutes(Collections.emptyList()); - } - - @Test - public void setNeutronId() throws Exception { - subnet.setNeutronId("test"); - } - - @Test - public void setIpVersion() throws Exception { - subnet.setIpVersion("ipv4"); - } - - @Test - public void setSubnetId() throws Exception { - subnet.setSubnetId("1.0.0.0"); - } - -}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackTest.java deleted file mode 100644 index 9891811b86..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackTest.java +++ /dev/null @@ -1,179 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.openstack.beans; - -import org.junit.Test; -import org.openecomp.mso.entity.MsoRequest; - -public class VnfRollbackTest { - - VnfRollback vnfRollback = new VnfRollback(); - - @Test - public void getVnfId() throws Exception { - vnfRollback.getVnfId(); - } - - @Test - public void setVnfId() throws Exception { - vnfRollback.setVnfId("test"); - } - - @Test - public void getTenantId() throws Exception { - vnfRollback.getTenantId(); - } - - @Test - public void setTenantId() throws Exception { - vnfRollback.setTenantId("test"); - } - - @Test - public void getCloudSiteId() throws Exception { - vnfRollback.getCloudSiteId(); - } - - @Test - public void setCloudSiteId() throws Exception { - vnfRollback.setCloudSiteId("test"); - } - - @Test - public void getTenantCreated() throws Exception { - vnfRollback.getTenantCreated(); - } - - @Test - public void setTenantCreated() throws Exception { - vnfRollback.setTenantCreated(true); - } - - @Test - public void getVnfCreated() throws Exception { - vnfRollback.getVnfCreated(); - } - - @Test - public void setVnfCreated() throws Exception { - vnfRollback.setVnfCreated(true); - } - - @Test - public void getMsoRequest() throws Exception { - vnfRollback.getMsoRequest(); - } - - @Test - public void setMsoRequest() throws Exception { - vnfRollback.setMsoRequest(new MsoRequest()); - } - - @Test - public void getVolumeGroupName() throws Exception { - vnfRollback.getVolumeGroupName(); - } - - @Test - public void setVolumeGroupName() throws Exception { - vnfRollback.setVolumeGroupName("test"); - } - - @Test - public void getVolumeGroupId() throws Exception { - vnfRollback.getVolumeGroupId(); - } - - @Test - public void setVolumeGroupId() throws Exception { - vnfRollback.setVolumeGroupId("test"); - } - - @Test - public void getRequestType() throws Exception { - vnfRollback.getRequestType(); - } - - @Test - public void setRequestType() throws Exception { - vnfRollback.setRequestType("test"); - } - - @Test - public void getVolumeGroupHeatStackId() throws Exception { - vnfRollback.getVolumeGroupHeatStackId(); - } - - @Test - public void setVolumeGroupHeatStackId() throws Exception { - vnfRollback.setVolumeGroupHeatStackId("test"); - } - - @Test - public void getBaseGroupHeatStackId() throws Exception { - vnfRollback.getBaseGroupHeatStackId(); - } - - @Test - public void setBaseGroupHeatStackId() throws Exception { - vnfRollback.setBaseGroupHeatStackId("test"); - } - - @Test - public void isBase() throws Exception { - vnfRollback.isBase(); - } - - @Test - public void setIsBase() throws Exception { - vnfRollback.setIsBase(true); - } - - @Test - public void getVfModuleStackId() throws Exception { - vnfRollback.getVfModuleStackId(); - } - - @Test - public void setVfModuleStackId() throws Exception { - vnfRollback.setVfModuleStackId("test"); - } - - @Test - public void getModelCustomizationUuid() throws Exception { - vnfRollback.getModelCustomizationUuid(); - } - - @Test - public void setModelCustomizationUuid() throws Exception { - vnfRollback.setModelCustomizationUuid("test"); - } - - @Test - public void getMode() throws Exception { - vnfRollback.getMode(); - } - - @Test - public void setMode() throws Exception { - vnfRollback.setMode("test"); - } - -}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/resources/stack-example.json b/adapters/mso-adapters-rest-interface/src/test/resources/stack-example.json new file mode 100644 index 0000000000..c0f08f8bd7 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/resources/stack-example.json @@ -0,0 +1,13 @@ +{ + "outputs" : [{ + "outputKey": "key1", + "outputValue": "value1" + },{ + "outputKey": "key2", + "outputValue": "value2" + },{ + "outputKey": "key3", + "outputValue": "value3" + }] + +}
\ No newline at end of file |