diff options
author | 2019-02-11 17:00:46 +0000 | |
---|---|---|
committer | 2019-02-11 17:01:03 +0000 | |
commit | d8850d592f42d16a7d3d8d0c4ae1c64badf0b439 (patch) | |
tree | 8cbf50caeda36a39becef612fc3ed02809b777c5 /pomba/network-discovery/src/test | |
parent | c727082e6809f7a3076809dceb218e80ce4456bf (diff) |
Add support for Openstack Port object
Issue-ID: SDNC-475
Change-Id: Id17404ed05b2ca251e46dc739657900953f76cc4
Signed-off-by: Norm Traxler <normant@amdocs.com>
Diffstat (limited to 'pomba/network-discovery/src/test')
4 files changed, 78 insertions, 1 deletions
diff --git a/pomba/network-discovery/src/test/java/org/onap/sdnc/apps/pomba/networkdiscovery/unittest/service/util/TransformationUtilTest.java b/pomba/network-discovery/src/test/java/org/onap/sdnc/apps/pomba/networkdiscovery/unittest/service/util/TransformationUtilTest.java index f43fa60..cd076c0 100644 --- a/pomba/network-discovery/src/test/java/org/onap/sdnc/apps/pomba/networkdiscovery/unittest/service/util/TransformationUtilTest.java +++ b/pomba/network-discovery/src/test/java/org/onap/sdnc/apps/pomba/networkdiscovery/unittest/service/util/TransformationUtilTest.java @@ -72,6 +72,24 @@ public class TransformationUtilTest { JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(resourceInstJson)));
}
+
+ @Test
+ public void testTransformPort() {
+
+ Object sourceObject = JsonUtils.filepathToObject(TEST_RESOURCES + "port-input.json");
+ String resultJson = TransformationUtil.transform(JsonUtils.toJsonString(sourceObject), "port");
+
+ Gson gson = new Gson();
+ Resource resourceInst = gson.fromJson(resultJson, Resource.class);
+ String resourceInstJson = gson.toJson(resourceInst);
+
+ Object expectedObject = JsonUtils.filepathToObject(TEST_RESOURCES + "port-expected.json");
+
+ Assert.assertEquals("Json transformation result does not match expected content",
+ JsonUtils.toPrettyJsonString(expectedObject),
+ JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(resourceInstJson)));
+
+ }
@Test
public void testTransformFailureFileNotFound() {
diff --git a/pomba/network-discovery/src/test/resources/jolt/l3network-expected.json b/pomba/network-discovery/src/test/resources/jolt/l3network-expected.json index e9e37dd..2cf8f90 100644 --- a/pomba/network-discovery/src/test/resources/jolt/l3network-expected.json +++ b/pomba/network-discovery/src/test/resources/jolt/l3network-expected.json @@ -6,7 +6,7 @@ "status" : "ok"
},
"attributeList" : [ {
- "name" : "adminState",
+ "name" : "adminStateUp",
"value" : "true",
"dataQuality" : {
"status" : "ok"
diff --git a/pomba/network-discovery/src/test/resources/jolt/port-expected.json b/pomba/network-discovery/src/test/resources/jolt/port-expected.json new file mode 100644 index 0000000..33f6dc1 --- /dev/null +++ b/pomba/network-discovery/src/test/resources/jolt/port-expected.json @@ -0,0 +1,21 @@ +{
+ "id" : "bcd87883-c92f-4f2b-b5bf-1288948facdd",
+ "name" : "bcd8",
+ "type" : "port",
+ "dataQuality" : {
+ "status" : "ok"
+ },
+ "attributeList" : [ {
+ "name" : "adminStateUp",
+ "value" : "true",
+ "dataQuality" : {
+ "status" : "ok"
+ }
+ }, {
+ "name" : "macAddress",
+ "value" : "fa:16:3e:ff:f7:af",
+ "dataQuality" : {
+ "status" : "ok"
+ }
+ } ]
+}
\ No newline at end of file diff --git a/pomba/network-discovery/src/test/resources/jolt/port-input.json b/pomba/network-discovery/src/test/resources/jolt/port-input.json new file mode 100644 index 0000000..7e3e59b --- /dev/null +++ b/pomba/network-discovery/src/test/resources/jolt/port-input.json @@ -0,0 +1,38 @@ +{ + "port": { + "status": "ACTIVE", + "binding:host_id": "Setup-D2-OTT-A-Master", + "description": "", + "allowed_address_pairs": [], + "tags": [], + "extra_dhcp_opts": [], + "updated_at": "2019-02-07T21:11:17Z", + "device_owner": "compute:nova", + "revision_number": 9, + "binding:profile": {}, + "fixed_ips": [ + { + "subnet_id": "b3684cd7-43ee-4aa3-9266-8c66f87d10a3", + "ip_address": "10.69.102.6" + } + ], + "id": "bcd87883-c92f-4f2b-b5bf-1288948facdd", + "security_groups": [ + "6e0243dc-5040-491a-b54e-55b88cd01855" + ], + "device_id": "645a12dc-09b5-45cb-8ab1-a0ce41b7200a", + "name": "bcd8", + "admin_state_up": true, + "network_id": "2ea02809-7279-4b5e-931a-62b231615497", + "tenant_id": "1130b349e19c4827bf91a29d51256af1", + "binding:vif_details": { + "port_filter": true, + "ovs_hybrid_plug": true + }, + "binding:vnic_type": "normal", + "binding:vif_type": "ovs", + "mac_address": "fa:16:3e:ff:f7:af", + "project_id": "1130b349e19c4827bf91a29d51256af1", + "created_at": "2018-12-04T20:40:58Z" + } +}
\ No newline at end of file |