Groovy scripts header correction
[so.git] / bpmn / MSOCommonBPMN / src / test / groovy / org / openecomp / mso / bpmn / common / scripts / MsoUtilsTest.groovy
1 /*- 
2  * ============LICENSE_START======================================================= 
3  * ONAP - SO 
4  * ================================================================================ 
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. 
6  * ================================================================================ 
7  * Licensed under the Apache License, Version 2.0 (the "License"); 
8  * you may not use this file except in compliance with the License. 
9  * You may obtain a copy of the License at 
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0 
12  * 
13  * Unless required by applicable law or agreed to in writing, software 
14  * distributed under the License is distributed on an "AS IS" BASIS, 
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
16  * See the License for the specific language governing permissions and 
17  * limitations under the License. 
18  * ============LICENSE_END========================================================= 
19  */ 
20
21 package org.openecomp.mso.bpmn.common.scripts
22
23 // JUnit 4
24 import org.junit.Test
25 import org.junit.Before;
26 import org.junit.Ignore;
27 import org.junit.Rule;
28
29 import static groovy.test.GroovyAssert.shouldFail
30 import static groovy.test.GroovyAssert.assertTrue
31 import static groovy.test.GroovyAssert.assertEquals
32
33 import org.openecomp.mso.bpmn.common.scripts.MsoUtils;
34 import org.apache.commons.lang3.*
35
36
37 class MsoUtilsTest {
38                    
39                 def utils = new MsoUtils()
40                 def origXmlResponse = null
41                 // Expected rebuilds
42                 def expected_buildElements = "<tns2:internet-service-change-details><tns2:internet-evc-speed-value>10</tns2:internet-evc-speed-value><tns2:internet-evc-speed-units>Kbps</tns2:internet-evc-speed-units><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v4-next-hop-address>192.168.1.15</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.15</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>2</tns2:request-index><tns2:v4-next-hop-address>192.168.1.16</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.16</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes></tns2:internet-service-change-details>"
43             def expected_rebuildDhcp = "<tns2:dhcp><tns2:v4-dhcp-server-enabled>Y</tns2:v4-dhcp-server-enabled><tns2:v6-dhcp-server-enabled>N</tns2:v6-dhcp-server-enabled><tns2:use-v4-default-pool>Y</tns2:use-v4-default-pool><tns2:excluded-v4-dhcp-addresses-from-default-pool><tns2:excluded-v4-address>192.168.1.7</tns2:excluded-v4-address></tns2:excluded-v4-dhcp-addresses-from-default-pool><tns2:excluded-v4-dhcp-addresses-from-default-pool><tns2:excluded-v4-address>192.168.1.8</tns2:excluded-v4-address></tns2:excluded-v4-dhcp-addresses-from-default-pool><tns2:v4-dhcp-pools><tns2:v4-dhcp-pool-prefix>192.155.2.3</tns2:v4-dhcp-pool-prefix><tns2:v4-dhcp-pool-prefix-length>28</tns2:v4-dhcp-pool-prefix-length><tns2:excluded-v4-addresses><tns2:excluded-v4-address>192.168.1.5</tns2:excluded-v4-address></tns2:excluded-v4-addresses><tns2:excluded-v4-addresses><tns2:excluded-v4-address>192.168.1.6</tns2:excluded-v4-address></tns2:excluded-v4-addresses><tns2:v4-dhcp-relay-gateway-address>2.2.2.1</tns2:v4-dhcp-relay-gateway-address><tns2:v4-dhcp-relay-next-hop-address>1.1.1.1</tns2:v4-dhcp-relay-next-hop-address></tns2:v4-dhcp-pools><tns2:v4-dhcp-pools><tns2:v4-dhcp-pool-prefix>192.155.2.4</tns2:v4-dhcp-pool-prefix><tns2:v4-dhcp-pool-prefix-length>28</tns2:v4-dhcp-pool-prefix-length><tns2:excluded-v4-addresses><tns2:excluded-v4-address>192.168.1.6</tns2:excluded-v4-address></tns2:excluded-v4-addresses><tns2:excluded-v4-addresses><tns2:excluded-v4-address>192.168.1.7</tns2:excluded-v4-address></tns2:excluded-v4-addresses><tns2:v4-dhcp-relay-gateway-address>2.2.2.2</tns2:v4-dhcp-relay-gateway-address><tns2:v4-dhcp-relay-next-hop-address>1.1.1.2</tns2:v4-dhcp-relay-next-hop-address></tns2:v4-dhcp-pools><tns2:use-v6-default-pool>N</tns2:use-v6-default-pool><tns2:excluded-v6-dhcp-addresses-from-default-pool><tns2:excluded-v6-address>1:5</tns2:excluded-v6-address></tns2:excluded-v6-dhcp-addresses-from-default-pool><tns2:excluded-v6-dhcp-addresses-from-default-pool><tns2:excluded-v6-address>1:6</tns2:excluded-v6-address></tns2:excluded-v6-dhcp-addresses-from-default-pool><tns2:v6-dhcp-pools><tns2:v6-dhcp-pool-prefix>0:0</tns2:v6-dhcp-pool-prefix><tns2:v6-dhcp-pool-prefix-length>28</tns2:v6-dhcp-pool-prefix-length><tns2:excluded-v6-addresses><tns2:excluded-v6-address>1:1</tns2:excluded-v6-address></tns2:excluded-v6-addresses><tns2:excluded-v6-addresses><tns2:excluded-v6-address>2:2</tns2:excluded-v6-address></tns2:excluded-v6-addresses><tns2:v6-dhcp-relay-gateway-address>3:3</tns2:v6-dhcp-relay-gateway-address><tns2:v6-dhcp-relay-next-hop-address>4:4</tns2:v6-dhcp-relay-next-hop-address></tns2:v6-dhcp-pools><tns2:v6-dhcp-pools><tns2:v6-dhcp-pool-prefix>0:0</tns2:v6-dhcp-pool-prefix><tns2:v6-dhcp-pool-prefix-length>28</tns2:v6-dhcp-pool-prefix-length><tns2:excluded-v6-addresses><tns2:excluded-v6-address>1:1</tns2:excluded-v6-address></tns2:excluded-v6-addresses><tns2:excluded-v6-addresses><tns2:excluded-v6-address>2:2</tns2:excluded-v6-address></tns2:excluded-v6-addresses><tns2:v6-dhcp-relay-gateway-address>3:3</tns2:v6-dhcp-relay-gateway-address><tns2:v6-dhcp-relay-next-hop-address>4:4</tns2:v6-dhcp-relay-next-hop-address></tns2:v6-dhcp-pools></tns2:dhcp>" 
44             def expected_rebuildFirewallLite = "<tns2:firewall-lite><tns2:stateful-firewall-lite-v4-enabled>Y</tns2:stateful-firewall-lite-v4-enabled><tns2:stateful-firewall-lite-v6-enabled>N</tns2:stateful-firewall-lite-v6-enabled><tns2:v4-firewall-packet-filters><tns2:v4-firewall-prefix>0.0.0.1</tns2:v4-firewall-prefix><tns2:v4-firewall-prefix-length>1</tns2:v4-firewall-prefix-length><tns2:allow-icmp-ping>Y</tns2:allow-icmp-ping><tns2:udp-ports><tns2:port-number>1</tns2:port-number></tns2:udp-ports><tns2:tcp-ports><tns2:port-number>1</tns2:port-number></tns2:tcp-ports></tns2:v4-firewall-packet-filters><tns2:v4-firewall-packet-filters><tns2:v4-firewall-prefix>0.0.0.2</tns2:v4-firewall-prefix><tns2:v4-firewall-prefix-length>2</tns2:v4-firewall-prefix-length><tns2:allow-icmp-ping>Y</tns2:allow-icmp-ping><tns2:udp-ports><tns2:port-number>2</tns2:port-number></tns2:udp-ports><tns2:tcp-ports><tns2:port-number>2</tns2:port-number></tns2:tcp-ports></tns2:v4-firewall-packet-filters><tns2:v6-firewall-packet-filters><tns2:v6-firewall-prefix>:</tns2:v6-firewall-prefix><tns2:v6-firewall-prefix-length>0</tns2:v6-firewall-prefix-length><tns2:allow-icmp-ping>Y</tns2:allow-icmp-ping><tns2:udp-ports><tns2:port-number>3</tns2:port-number></tns2:udp-ports><tns2:tcp-ports><tns2:port-number>3</tns2:port-number></tns2:tcp-ports></tns2:v6-firewall-packet-filters><tns2:v6-firewall-packet-filters><tns2:v6-firewall-prefix>:</tns2:v6-firewall-prefix><tns2:v6-firewall-prefix-length>1</tns2:v6-firewall-prefix-length><tns2:allow-icmp-ping>Y</tns2:allow-icmp-ping><tns2:udp-ports><tns2:port-number>4</tns2:port-number></tns2:udp-ports><tns2:tcp-ports><tns2:port-number>4</tns2:port-number></tns2:tcp-ports></tns2:v6-firewall-packet-filters></tns2:firewall-lite>" 
45             def expected_rebuildInternetEvcAccess = "<tns2:internet-evc-access-information><tns2:internet-evc-speed-value>8</tns2:internet-evc-speed-value><tns2:internet-evc-speed-units>Mbps</tns2:internet-evc-speed-units><tns2:ip-version>ds</tns2:ip-version></tns2:internet-evc-access-information>"
46             def expected_rebuildInternetServiceChangeDetails = "<tns:internet-service-change-details><tns2:internet-evc-speed-value>10</tns2:internet-evc-speed-value><tns2:internet-evc-speed-units>Kbps</tns2:internet-evc-speed-units><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v4-next-hop-address>192.168.1.15</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.15</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>2</tns2:request-index><tns2:v4-next-hop-address>192.168.1.16</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.16</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:2da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:2da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes></tns:internet-service-change-details>"
47             def expected_rebuildL2Home = "<tns2:l2-homing-information><tns2:evc-name>AS/VLXM/003717//SW</tns2:evc-name><tns2:topology>MultiPoint</tns2:topology><tns2:preferred-aic-clli>MTSNJA4LCP1</tns2:preferred-aic-clli></tns2:l2-homing-information>"
48             def expected_rebuildNat = "<tns2:nat><tns2:v4-nat-enabled>Y</tns2:v4-nat-enabled><tns2:v4-nat-mapping-entries><tns2:v4-nat-internal>0.0.0.0</tns2:v4-nat-internal><tns2:v4-nat-next-hop-address>0.0.0.0</tns2:v4-nat-next-hop-address><tns2:v4-nat-external>0.0.0.0</tns2:v4-nat-external></tns2:v4-nat-mapping-entries><tns2:v4-nat-mapping-entries><tns2:v4-nat-internal>0.0.0.1</tns2:v4-nat-internal><tns2:v4-nat-next-hop-address>0.0.0.1</tns2:v4-nat-next-hop-address><tns2:v4-nat-external>0.0.0.1</tns2:v4-nat-external></tns2:v4-nat-mapping-entries></tns2:nat>"
49             def expected_rebuildPat = "<tns2:pat><tns2:v4-pat-enabled>N</tns2:v4-pat-enabled><tns2:use-v4-default-pool>Y</tns2:use-v4-default-pool><tns2:v4-pat-pools><tns2:v4-pat-pool-prefix>192.168.1.44</tns2:v4-pat-pool-prefix><tns2:v4-pat-pool-prefix-length>0</tns2:v4-pat-pool-prefix-length><tns2:v4-pat-pool-next-hop-address>192.168.1.5</tns2:v4-pat-pool-next-hop-address></tns2:v4-pat-pools><tns2:v4-pat-pools><tns2:v4-pat-pool-prefix>192.168.1.45</tns2:v4-pat-pool-prefix><tns2:v4-pat-pool-prefix-length>28</tns2:v4-pat-pool-prefix-length><tns2:v4-pat-pool-next-hop-address>192.168.1.6</tns2:v4-pat-pool-next-hop-address></tns2:v4-pat-pools></tns2:pat>"
50             def expected_rebuildStaticRoutes = "<tns2:static-routes><tns2:v4-static-routes><tns2:v4-static-route-prefix>255.255.252.1</tns2:v4-static-route-prefix><tns2:v4-static-route-prefix-length>28</tns2:v4-static-route-prefix-length><tns2:v4-next-hop-address>192.168.1.15</tns2:v4-next-hop-address></tns2:v4-static-routes><tns2:v4-static-routes><tns2:v4-static-route-prefix>255.255.252.2</tns2:v4-static-route-prefix><tns2:v4-static-route-prefix-length>28</tns2:v4-static-route-prefix-length><tns2:v4-next-hop-address>192.168.1.15</tns2:v4-next-hop-address></tns2:v4-static-routes><tns2:v4-static-routes><tns2:v4-static-route-prefix>255.255.252.3</tns2:v4-static-route-prefix><tns2:v4-static-route-prefix-length>28</tns2:v4-static-route-prefix-length><tns2:v4-next-hop-address>192.168.1.15</tns2:v4-next-hop-address></tns2:v4-static-routes><tns2:v6-static-routes><tns2:v6-static-route-prefix>2001:1890:12e3:2da::</tns2:v6-static-route-prefix><tns2:v6-static-route-prefix-length>28</tns2:v6-static-route-prefix-length><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address></tns2:v6-static-routes><tns2:v6-static-routes><tns2:v6-static-route-prefix>2001:1890:12e3:2da::</tns2:v6-static-route-prefix><tns2:v6-static-route-prefix-length>28</tns2:v6-static-route-prefix-length><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address></tns2:v6-static-routes></tns2:static-routes>"
51             def expected_rebuildUcpeVmsServiceInformation = "<tns2:ucpe-vms-service-information><tns2:transport-service-information><tns2:transport-service-type>AVPN</tns2:transport-service-type><tns2:access-circuit-info><tns2:access-circuit-id>1</tns2:access-circuit-id><tns2:dual-mode>Active</tns2:dual-mode></tns2:access-circuit-info><tns2:access-circuit-info><tns2:access-circuit-id>2</tns2:access-circuit-id><tns2:dual-mode>Standby</tns2:dual-mode></tns2:access-circuit-info></tns2:transport-service-information><tns2:ucpe-information><tns2:ucpe-host-name>hostname</tns2:ucpe-host-name><tns2:ucpe-activation-code>activecode</tns2:ucpe-activation-code><tns2:out-of-band-management-modem>OOB</tns2:out-of-band-management-modem></tns2:ucpe-information><tns2:vnf-list><tns2:vnf-information><tns2:vnf-instance-id>1</tns2:vnf-instance-id><tns2:vnf-sequence-number>1</tns2:vnf-sequence-number><tns2:vnf-type>ZZ</tns2:vnf-type><tns2:vnf-vendor>JUNIPER</tns2:vnf-vendor><tns2:vnf-model>MODEL1</tns2:vnf-model><tns2:vnf-id>1</tns2:vnf-id><tns2:prov-status>1</tns2:prov-status><tns2:operational-state>1</tns2:operational-state><tns2:orchestration-status>1</tns2:orchestration-status><tns2:equipment-role>1</tns2:equipment-role></tns2:vnf-information><tns2:vnf-information><tns2:vnf-instance-id>2</tns2:vnf-instance-id><tns2:vnf-sequence-number>2</tns2:vnf-sequence-number><tns2:vnf-type>HY</tns2:vnf-type><tns2:vnf-vendor>JUNIPER</tns2:vnf-vendor><tns2:vnf-model>MODEL2</tns2:vnf-model><tns2:vnf-id>2</tns2:vnf-id><tns2:prov-status>2</tns2:prov-status><tns2:operational-state>2</tns2:operational-state><tns2:orchestration-status>2</tns2:orchestration-status><tns2:equipment-role>2</tns2:equipment-role></tns2:vnf-information></tns2:vnf-list></tns2:ucpe-vms-service-information>"
52             def expected_rebuildVrLan = "<tns2:vr-lan><tns2:routing-protocol>none</tns2:routing-protocol><tns2:vr-lan-interface><tns2:vr-designation>primary</tns2:vr-designation><tns2:v4-vr-lan-prefix>10.192.27.254</tns2:v4-vr-lan-prefix><tns2:v4-vr-lan-prefix-length>24</tns2:v4-vr-lan-prefix-length><tns2:v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</tns2:v6-vr-lan-prefix><tns2:v6-vr-lan-prefix-length>64</tns2:v6-vr-lan-prefix-length><tns2:v4-vce-loopback-address>162.200.3.144</tns2:v4-vce-loopback-address><tns2:v6-vce-wan-address>2001:1890:12e3:2da::</tns2:v6-vce-wan-address><tns2:v4-public-lan-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v4-next-hop-address>192.168.1.2</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.1</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v4-next-hop-address>192.168.1.72</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.71</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v4-next-hop-address>192.168.1.68</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.67</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes></tns2:v4-public-lan-prefixes><tns2:v6-public-lan-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:2da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:3da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:4da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes></tns2:v6-public-lan-prefixes><tns2:dhcp><tns2:v4-dhcp-server-enabled>Y</tns2:v4-dhcp-server-enabled><tns2:v6-dhcp-server-enabled>N</tns2:v6-dhcp-server-enabled><tns2:use-v4-default-pool>Y</tns2:use-v4-default-pool><tns2:excluded-v4-dhcp-addresses-from-default-pool><tns2:excluded-v4-address>192.168.1.7</tns2:excluded-v4-address></tns2:excluded-v4-dhcp-addresses-from-default-pool><tns2:excluded-v4-dhcp-addresses-from-default-pool><tns2:excluded-v4-address>192.168.1.8</tns2:excluded-v4-address></tns2:excluded-v4-dhcp-addresses-from-default-pool><tns2:v4-dhcp-pools><tns2:v4-dhcp-pool-prefix>192.155.2.3</tns2:v4-dhcp-pool-prefix><tns2:v4-dhcp-pool-prefix-length>28</tns2:v4-dhcp-pool-prefix-length><tns2:excluded-v4-addresses><tns2:excluded-v4-address>192.168.1.5</tns2:excluded-v4-address></tns2:excluded-v4-addresses><tns2:excluded-v4-addresses><tns2:excluded-v4-address>192.168.1.6</tns2:excluded-v4-address></tns2:excluded-v4-addresses><tns2:v4-dhcp-relay-gateway-address>2.2.2.1</tns2:v4-dhcp-relay-gateway-address><tns2:v4-dhcp-relay-next-hop-address>1.1.1.1</tns2:v4-dhcp-relay-next-hop-address></tns2:v4-dhcp-pools><tns2:v4-dhcp-pools><tns2:v4-dhcp-pool-prefix>192.155.2.4</tns2:v4-dhcp-pool-prefix><tns2:v4-dhcp-pool-prefix-length>28</tns2:v4-dhcp-pool-prefix-length><tns2:excluded-v4-addresses><tns2:excluded-v4-address>192.168.1.6</tns2:excluded-v4-address></tns2:excluded-v4-addresses><tns2:excluded-v4-addresses><tns2:excluded-v4-address>192.168.1.7</tns2:excluded-v4-address></tns2:excluded-v4-addresses><tns2:v4-dhcp-relay-gateway-address>2.2.2.2</tns2:v4-dhcp-relay-gateway-address><tns2:v4-dhcp-relay-next-hop-address>1.1.1.2</tns2:v4-dhcp-relay-next-hop-address></tns2:v4-dhcp-pools><tns2:use-v6-default-pool>N</tns2:use-v6-default-pool><tns2:excluded-v6-dhcp-addresses-from-default-pool><tns2:excluded-v6-address>1:5</tns2:excluded-v6-address></tns2:excluded-v6-dhcp-addresses-from-default-pool><tns2:excluded-v6-dhcp-addresses-from-default-pool><tns2:excluded-v6-address>1:6</tns2:excluded-v6-address></tns2:excluded-v6-dhcp-addresses-from-default-pool><tns2:v6-dhcp-pools><tns2:v6-dhcp-pool-prefix>0:0</tns2:v6-dhcp-pool-prefix><tns2:v6-dhcp-pool-prefix-length>28</tns2:v6-dhcp-pool-prefix-length><tns2:excluded-v6-addresses><tns2:excluded-v6-address>1:1</tns2:excluded-v6-address></tns2:excluded-v6-addresses><tns2:excluded-v6-addresses><tns2:excluded-v6-address>2:2</tns2:excluded-v6-address></tns2:excluded-v6-addresses><tns2:v6-dhcp-relay-gateway-address>3:3</tns2:v6-dhcp-relay-gateway-address><tns2:v6-dhcp-relay-next-hop-address>4:4</tns2:v6-dhcp-relay-next-hop-address></tns2:v6-dhcp-pools><tns2:v6-dhcp-pools><tns2:v6-dhcp-pool-prefix>0:0</tns2:v6-dhcp-pool-prefix><tns2:v6-dhcp-pool-prefix-length>28</tns2:v6-dhcp-pool-prefix-length><tns2:excluded-v6-addresses><tns2:excluded-v6-address>1:1</tns2:excluded-v6-address></tns2:excluded-v6-addresses><tns2:excluded-v6-addresses><tns2:excluded-v6-address>2:2</tns2:excluded-v6-address></tns2:excluded-v6-addresses><tns2:v6-dhcp-relay-gateway-address>3:3</tns2:v6-dhcp-relay-gateway-address><tns2:v6-dhcp-relay-next-hop-address>4:4</tns2:v6-dhcp-relay-next-hop-address></tns2:v6-dhcp-pools></tns2:dhcp><tns2:pat><tns2:v4-pat-enabled>N</tns2:v4-pat-enabled><tns2:use-v4-default-pool>Y</tns2:use-v4-default-pool><tns2:v4-pat-pools><tns2:v4-pat-pool-prefix>192.168.1.44</tns2:v4-pat-pool-prefix><tns2:v4-pat-pool-prefix-length>0</tns2:v4-pat-pool-prefix-length><tns2:v4-pat-pool-next-hop-address>192.168.1.5</tns2:v4-pat-pool-next-hop-address></tns2:v4-pat-pools><tns2:v4-pat-pools><tns2:v4-pat-pool-prefix>192.168.1.45</tns2:v4-pat-pool-prefix><tns2:v4-pat-pool-prefix-length>28</tns2:v4-pat-pool-prefix-length><tns2:v4-pat-pool-next-hop-address>192.168.1.6</tns2:v4-pat-pool-next-hop-address></tns2:v4-pat-pools></tns2:pat><tns2:nat><tns2:v4-nat-enabled>Y</tns2:v4-nat-enabled><tns2:v4-nat-mapping-entries><tns2:v4-nat-internal>0.0.0.0</tns2:v4-nat-internal><tns2:v4-nat-next-hop-address>0.0.0.0</tns2:v4-nat-next-hop-address><tns2:v4-nat-external>0.0.0.0</tns2:v4-nat-external></tns2:v4-nat-mapping-entries><tns2:v4-nat-mapping-entries><tns2:v4-nat-internal>0.0.0.1</tns2:v4-nat-internal><tns2:v4-nat-next-hop-address>0.0.0.1</tns2:v4-nat-next-hop-address><tns2:v4-nat-external>0.0.0.1</tns2:v4-nat-external></tns2:v4-nat-mapping-entries></tns2:nat><tns2:firewall-lite><tns2:stateful-firewall-lite-v4-enabled>Y</tns2:stateful-firewall-lite-v4-enabled><tns2:stateful-firewall-lite-v6-enabled>N</tns2:stateful-firewall-lite-v6-enabled><tns2:v4-firewall-packet-filters><tns2:v4-firewall-prefix>0.0.0.1</tns2:v4-firewall-prefix><tns2:v4-firewall-prefix-length>1</tns2:v4-firewall-prefix-length><tns2:allow-icmp-ping>Y</tns2:allow-icmp-ping><tns2:udp-ports><tns2:port-number>1</tns2:port-number></tns2:udp-ports><tns2:tcp-ports><tns2:port-number>1</tns2:port-number></tns2:tcp-ports></tns2:v4-firewall-packet-filters><tns2:v4-firewall-packet-filters><tns2:v4-firewall-prefix>0.0.0.2</tns2:v4-firewall-prefix><tns2:v4-firewall-prefix-length>2</tns2:v4-firewall-prefix-length><tns2:allow-icmp-ping>Y</tns2:allow-icmp-ping><tns2:udp-ports><tns2:port-number>2</tns2:port-number></tns2:udp-ports><tns2:tcp-ports><tns2:port-number>2</tns2:port-number></tns2:tcp-ports></tns2:v4-firewall-packet-filters><tns2:v6-firewall-packet-filters><tns2:v6-firewall-prefix>:</tns2:v6-firewall-prefix><tns2:v6-firewall-prefix-length>0</tns2:v6-firewall-prefix-length><tns2:allow-icmp-ping>Y</tns2:allow-icmp-ping><tns2:udp-ports><tns2:port-number>3</tns2:port-number></tns2:udp-ports><tns2:tcp-ports><tns2:port-number>3</tns2:port-number></tns2:tcp-ports></tns2:v6-firewall-packet-filters><tns2:v6-firewall-packet-filters><tns2:v6-firewall-prefix>:</tns2:v6-firewall-prefix><tns2:v6-firewall-prefix-length>1</tns2:v6-firewall-prefix-length><tns2:allow-icmp-ping>Y</tns2:allow-icmp-ping><tns2:udp-ports><tns2:port-number>4</tns2:port-number></tns2:udp-ports><tns2:tcp-ports><tns2:port-number>4</tns2:port-number></tns2:tcp-ports></tns2:v6-firewall-packet-filters></tns2:firewall-lite><tns2:static-routes><tns2:v4-static-routes><tns2:v4-static-route-prefix>255.255.252.1</tns2:v4-static-route-prefix><tns2:v4-static-route-prefix-length>28</tns2:v4-static-route-prefix-length><tns2:v4-next-hop-address>192.168.1.15</tns2:v4-next-hop-address></tns2:v4-static-routes><tns2:v4-static-routes><tns2:v4-static-route-prefix>255.255.252.2</tns2:v4-static-route-prefix><tns2:v4-static-route-prefix-length>28</tns2:v4-static-route-prefix-length><tns2:v4-next-hop-address>192.168.1.15</tns2:v4-next-hop-address></tns2:v4-static-routes><tns2:v4-static-routes><tns2:v4-static-route-prefix>255.255.252.3</tns2:v4-static-route-prefix><tns2:v4-static-route-prefix-length>28</tns2:v4-static-route-prefix-length><tns2:v4-next-hop-address>192.168.1.15</tns2:v4-next-hop-address></tns2:v4-static-routes><tns2:v6-static-routes><tns2:v6-static-route-prefix>2001:1890:12e3:2da::</tns2:v6-static-route-prefix><tns2:v6-static-route-prefix-length>28</tns2:v6-static-route-prefix-length><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address></tns2:v6-static-routes><tns2:v6-static-routes><tns2:v6-static-route-prefix>2001:1890:12e3:2da::</tns2:v6-static-route-prefix><tns2:v6-static-route-prefix-length>28</tns2:v6-static-route-prefix-length><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address></tns2:v6-static-routes></tns2:static-routes></tns2:vr-lan-interface></tns2:vr-lan>"
53             def expected_rebuildVrLanInterfacePartial = "<tns2:vr-designation>primary</tns2:vr-designation><tns2:v4-vr-lan-prefix>10.192.27.254</tns2:v4-vr-lan-prefix><tns2:v4-vr-lan-prefix-length>24</tns2:v4-vr-lan-prefix-length><tns2:v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</tns2:v6-vr-lan-prefix><tns2:v6-vr-lan-prefix-length>64</tns2:v6-vr-lan-prefix-length><tns2:v4-vce-loopback-address>162.200.3.144</tns2:v4-vce-loopback-address><tns2:v6-vce-wan-address>2001:1890:12e3:2da::</tns2:v6-vce-wan-address><tns2:v4-public-lan-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v4-next-hop-address>192.168.1.2</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.1</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v4-next-hop-address>192.168.1.72</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.71</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v4-next-hop-address>192.168.1.68</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.67</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v4-next-hop-address>192.168.1.15</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.15</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes><tns2:t-provided-v4-lan-public-prefixes><tns2:request-index>2</tns2:request-index><tns2:v4-next-hop-address>192.168.1.16</tns2:v4-next-hop-address><tns2:v4-lan-public-prefix>192.168.1.16</tns2:v4-lan-public-prefix><tns2:v4-lan-public-prefix-length>28</tns2:v4-lan-public-prefix-length></tns2:t-provided-v4-lan-public-prefixes></tns2:v4-public-lan-prefixes><tns2:v6-public-lan-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:2da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:3da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:4da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:2da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes><tns2:t-provided-v6-lan-public-prefixes><tns2:request-index>1</tns2:request-index><tns2:v6-next-hop-address>2001:1890:12e3:2da::</tns2:v6-next-hop-address><tns2:v6-lan-public-prefix>2001:1890:12e3:2da::</tns2:v6-lan-public-prefix><tns2:v6-lan-public-prefix-length>28</tns2:v6-lan-public-prefix-length></tns2:t-provided-v6-lan-public-prefixes></tns2:v6-public-lan-prefixes>"
54                 
55             @Before
56                 public void setUp() {
57                         def responseAsString = getFile("sdncadaptercallbackrequest.xml")
58                         def varrequestData=utils.getNodeText(responseAsString,"RequestData")
59                         //def varResponseListData = StringEscapeUtils.unescapeXml(varrequestData)
60                         def varResponseListData = varrequestData.replace("&", "&amp;")
61                         origXmlResponse = utils.getNodeXml(varResponseListData, "layer3-service-list").drop(38).trim()
62
63                 }
64         
65                 @Test
66                 public void testBuildL2Home() {
67                         def rebuildL2Home = utils.buildL2HomingInformation(origXmlResponse)
68                         println " rebuildL2Home: "
69                         println "  actual    - " + rebuildL2Home 
70                         println "  expected  - " + expected_rebuildL2Home
71                         assertEquals("rebuildL2Home - expected vs actual", expected_rebuildL2Home, rebuildL2Home)
72                 }
73
74                 @Test
75                 public void testBuildInternetEvcAccess() {
76                         def rebuildInternetEvcAccess = utils.buildInternetEvcAccessInformation(origXmlResponse)
77                         println " rebuildInternetEvcAccess: "
78                         println "  actual    - " + rebuildInternetEvcAccess
79                         println "  expected  - " + expected_rebuildInternetEvcAccess
80                         assertEquals("rebuildInternetEvcAccess - expected vs actual", expected_rebuildInternetEvcAccess, rebuildInternetEvcAccess)
81                 }
82
83                 @Test
84                 public void testBuildInternetServiceChangeDetails() {
85                         def rebuildInternetServiceChangeDetails = utils.buildInternetServiceChangeDetails(origXmlResponse)
86                         println " rebuildInternetServiceChangeDetails: "
87                         println "  actual    - " + rebuildInternetServiceChangeDetails
88                         println "  expected  - " + expected_rebuildInternetServiceChangeDetails
89                         assertEquals("rebuildInternetServiceChangeDetails - expected vs actual", expected_rebuildInternetServiceChangeDetails, rebuildInternetServiceChangeDetails)
90                 }
91                 
92                 // Coming v100
93                 @Test
94                 @Ignore
95                 public void testBuildUcpeVmsServiceInformation() {
96                         def rebuildUcpeVmsServiceInformation = utils.buildUcpeVmsServiceInformation(origXmlResponse)
97                         println " rebuildUcpeVmsServiceInformation: "
98                         println "  actual    - " + rebuildUcpeVmsServiceInformation
99                         println "  expected  - " + expected_rebuildUcpeVmsServiceInformation
100                         assertEquals("rebuildUcpeVmsServiceInformation - expected vs actual", expected_rebuildUcpeVmsServiceInformation, rebuildUcpeVmsServiceInformation)
101                 }
102
103                 @Test
104                 public void testBuildElements() {
105                         // testing utility codes: buildElements() & buildElementsUnblunded()
106                         def internetServiceChangeDetails = utils.getNodeXml(origXmlResponse, "internet-service-change-details").drop(38).trim()
107                         def buildElements = ''
108                         buildElements = "<tns2:internet-service-change-details>"
109                         buildElements += utils.buildElements(internetServiceChangeDetails, ["internet-evc-speed-value"], "")
110                         buildElements += utils.buildElements(internetServiceChangeDetails, ["internet-evc-speed-units"], "")
111                         def tProvidedV4LanPublicPrefixesChangesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length"]
112                         buildElements += utils.buildElementsUnbounded(internetServiceChangeDetails, tProvidedV4LanPublicPrefixesChangesList, "t-provided-v4-lan-public-prefixes")
113                         buildElements += "</tns2:internet-service-change-details>"
114                         println " buildElements: "
115                         println "  actual    - " + buildElements
116                         println "  expected  - " + expected_buildElements
117                         assertEquals("buildElements - expected vs actual", expected_buildElements, buildElements)
118                 } 
119                 
120                 @Test
121                 public void testBuildVrLan() {
122                         def rebuildVrLan = utils.buildVrLan(origXmlResponse)
123                         println " rebuildVrLans: "
124                         println "  actual    - " + rebuildVrLan
125                         println "  expected  - " + expected_rebuildVrLan
126                         assertEquals("rebuildVrLan - expected vs actual", expected_rebuildVrLan, rebuildVrLan)
127                 }
128                 
129                 @Test
130                 public void testBuildVrLanInterfacePartial() {
131                         def rebuildVrLanInterfacePartial = utils.buildVrLanInterfacePartial(origXmlResponse)
132                         println " rebuildVrLanInterfacePartial: "
133                         println "  actual    - " + rebuildVrLanInterfacePartial
134                         println "  expected  - " + expected_rebuildVrLanInterfacePartial
135                         assertEquals("rebuildVrLanInterfacePartial - expected vs actual", expected_rebuildVrLanInterfacePartial, rebuildVrLanInterfacePartial)
136                 }
137                 
138                 @Test
139                 public void testBuildDhcp() {
140                         def rebuildDhcp = utils.buildDhcp(origXmlResponse)
141                         println " rebuildDhcp: "
142                         println "  actual    - " + rebuildDhcp
143                         println "  expected  - " + expected_rebuildDhcp
144                         assertEquals("rebuildDhcp - expected vs actual", expected_rebuildDhcp, rebuildDhcp)
145                 }
146                 
147                 @Test
148                 public void testBuildPat() {
149                         def rebuildPat = utils.buildPat(origXmlResponse)
150                         println " rebuildPat: "
151                         println "  actual    - " + rebuildPat
152                         println "  expected  - " + expected_rebuildPat
153                         assertEquals("rebuildPat - expected vs actual", expected_rebuildPat, rebuildPat)
154                 }
155                 
156                 @Test
157                 public void testBuildNat() {
158                         def rebuildNat = utils.buildNat(origXmlResponse)
159                         println " rebuildNat: "
160                         println "  actual    - " + rebuildNat
161                         println "  expected  - " + expected_rebuildNat
162                         assertEquals("rebuildNat - expected vs actual", expected_rebuildNat, rebuildNat)
163                 }
164                 
165                 @Test
166                 public void testBuildFirewallLite() {
167                         def rebuildFirewallLite = utils.buildFirewallLite(origXmlResponse)
168                         println " rebuildFirewallLite: "
169                         println "  actual    - " + rebuildFirewallLite
170                         println "  expected  - " + expected_rebuildFirewallLite
171                         assertEquals("rebuildFirewallLite - expected vs actual", expected_rebuildFirewallLite, rebuildFirewallLite)
172                 }
173                 
174                 @Test
175                 public void testBuildStaticRoutes() {
176                         def rebuildStaticRoutes = utils.buildStaticRoutes(origXmlResponse)
177                         println " rebuildStaticRoutes: "
178                         println "  actual    - " + rebuildStaticRoutes
179                         println "  expected  - " + expected_rebuildStaticRoutes
180                         assertEquals("rebuildStaticRoutes - expected vs actual", expected_rebuildStaticRoutes, rebuildStaticRoutes)
181                 }
182                 
183                 @Test
184                 public void testGetBasicAuth(){
185                         def encodedAuth = utils.getBasicAuth("3E3CFA7BE2F6107AAD4AAA65F8976690","07a7159d3bf51a0e53be7a8f89699be7")
186                         assertEquals("Basic bXlTdHJpbmc=", encodedAuth)
187                 }
188                 
189                 @Test
190                 public void testEncrypt(){
191                         def encrypted = utils.encrypt("myString","07a7159d3bf51a0e53be7a8f89699be7")
192                         assertEquals("3E3CFA7BE2F6107AAD4AAA65F8976690", encrypted)
193                         
194                         //use to get value for urn properties
195                         //println(utils.encrypt("password"))
196                 }
197                 
198                 @Test
199                 public void testDecrypt(){
200                         def decrypted = utils.decrypt("3E3CFA7BE2F6107AAD4AAA65F8976690", "07a7159d3bf51a0e53be7a8f89699be7")
201                         assertEquals("myString", decrypted)
202                 }
203                 
204                 @Test
205                 public void testGetPBGFList(){
206                         def responseAsString = getFile("sdncDeleteResponse.xml")
207                         def nodes = utils.getPBGFList("true", responseAsString)
208                         //assertEquals(2, nodes.size())
209                         while(!nodes.empty){
210                         def myBGFXML = nodes.remove(0)
211                                 def myBGF= new XmlSlurper().parseText(myBGFXML)
212                                 println "borderElmtId: " + myBGF.'border-element-id'
213                                 println "vlanid: " + myBGF.'vlan-id' +"\n"
214                         }
215                 }
216                 
217                 public String getFile(String fileName) {
218                         def SLASH = File.separator
219                         def pathBase = ' '
220                         def fileAsString = ''
221                         try {
222                                 pathBase = new File(".").getCanonicalPath()
223                                 //println "pathBase " + pathBase + "${SLASH}src${SLASH}test${SLASH}resources${SLASH}${fileName}"
224                                 fileAsString = new File(pathBase, "${SLASH}src${SLASH}test${SLASH}resources${SLASH}${fileName}").getText()
225                         } catch (Exception ex) {
226                             println " *** getFile error: " + ex.getStackTrace()
227                         } finally {
228                             return fileAsString
229                         }
230                 }
231                                 
232
233 }