diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-08-16 16:19:56 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-08-16 16:19:56 +0000 |
commit | 95d9798e15d54270f73692b22b138b44f9defd7a (patch) | |
tree | 8c93ddf80dfb37dfd13253f8da4c69a023c4e95d /tests/unit/network_services/vnf_generic | |
parent | 4a5bc16d841221e8ac7853b3044e50af0c8143d2 (diff) | |
parent | c3d309865bb57e2aba2033d3bbe1c16adca4f0ba (diff) |
Merge "YAML fixes"
Diffstat (limited to 'tests/unit/network_services/vnf_generic')
-rw-r--r-- | tests/unit/network_services/vnf_generic/test_vnfdgen.py | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/tests/unit/network_services/vnf_generic/test_vnfdgen.py b/tests/unit/network_services/vnf_generic/test_vnfdgen.py index 44d9058dc..c2b923568 100644 --- a/tests/unit/network_services/vnf_generic/test_vnfdgen.py +++ b/tests/unit/network_services/vnf_generic/test_vnfdgen.py @@ -21,6 +21,7 @@ from __future__ import absolute_import import unittest from six.moves import range +from yardstick.common.yaml_loader import yaml_load from yardstick.network_services.vnf_generic import vnfdgen TREX_VNFD_TEMPLATE = """ @@ -65,6 +66,8 @@ vnfd:vnfd-catalog: dst_mac: '{{ interfaces.xe1.dst_mac }}' bandwidth: 10 Gbps vnfd-connection-point-ref: xe1 + routing_table: {{ routing_table }} + nd_route_tbl: {{ nd_route_tbl }} benchmark: kpi: @@ -126,6 +129,22 @@ COMPLETE_TREX_VNFD = \ 'vpci': '0000:00:10.1'}, 'vnfd-connection-point-ref': 'xe1'}], 'id': 'trexgen-baremetal', + 'nd_route_tbl': [{'gateway': '0064:ff9b:0:0:0:0:9810:6414', + 'if': 'xe0', + 'netmask': '112', + 'network': '0064:ff9b:0:0:0:0:9810:6414'}, + {'gateway': '0064:ff9b:0:0:0:0:9810:2814', + 'if': 'xe1', + 'netmask': '112', + 'network': '0064:ff9b:0:0:0:0:9810:2814'}], + 'routing_table': [{'gateway': '152.16.100.20', + 'if': 'xe0', + 'netmask': '255.255.255.0', + 'network': '152.16.100.20'}, + {'gateway': '152.16.40.20', + 'if': 'xe1', + 'netmask': '255.255.255.0', + 'network': '152.16.40.20'}], 'name': 'trexgen-baremetal'}]}]}} NODE_CFG = {'ip': '1.1.1.1', @@ -144,7 +163,24 @@ NODE_CFG = {'ip': '1.1.1.1', 'dst_mac': '00:01:02:03:04:06', 'local_ip': '2.1.1.2', 'local_mac': '00:01:02:03:05:06', - 'vpci': '0000:00:10.1'}}} + 'vpci': '0000:00:10.1'}}, + 'nd_route_tbl': [{u'gateway': u'0064:ff9b:0:0:0:0:9810:6414', + u'if': u'xe0', + u'netmask': u'112', + u'network': u'0064:ff9b:0:0:0:0:9810:6414'}, + {u'gateway': u'0064:ff9b:0:0:0:0:9810:2814', + u'if': u'xe1', + u'netmask': u'112', + u'network': u'0064:ff9b:0:0:0:0:9810:2814'}], + 'routing_table': [{u'gateway': u'152.16.100.20', + u'if': u'xe0', + u'netmask': u'255.255.255.0', + u'network': u'152.16.100.20'}, + {u'gateway': u'152.16.40.20', + u'if': u'xe1', + u'netmask': u'255.255.255.0', + u'network': u'152.16.40.20'}], + } TRAFFIC_PROFILE_TPL = """ @@ -169,6 +205,20 @@ TRAFFIC_PROFILE = { "1518B": '40'}}}}]} +class TestRender(unittest.TestCase): + + def test_render_none(self): + + tmpl = "{{ routing_table }}" + self.assertEqual(vnfdgen.render(tmpl, routing_table=None), u'~') + self.assertEqual(yaml_load(vnfdgen.render(tmpl, routing_table=None)), None) + + def test_render_unicode_dict(self): + + tmpl = "{{ routing_table }}" + self.assertEqual(yaml_load(vnfdgen.render(tmpl, **NODE_CFG)), NODE_CFG["routing_table"]) + + class TestVnfdGen(unittest.TestCase): """ Class to verify VNFS testcases """ |