From 50bcd3e477bc29abb43ed73643d551ff55a73403 Mon Sep 17 00:00:00 2001 From: Emma Foley Date: Thu, 12 Apr 2018 14:45:42 +0000 Subject: Remove unused methods in SampleVNF The following private methods are unused in yardstick/network_services/vnf_generic/vnf/sample_vnf.py:SampleVNF * _build_ports(self) * _get_route_data(self, route_index, route_type) * _get_port0localip6(self) * _get_port1localip6(self) * _get_port0prefixlen6(self) * _get_port1prefixlen6(self) * _get_port0gateway6(self) * _get_port1gateway6(self) They are being removed as: * _get_port* functions are already implemented and used in MultiPortConfig * _get_route_data is an auxillary functions used by the previous ones * _build_ports is implemented in the helpers JIRA: YARDSTICK-1122 Change-Id: Ie7a706cd87b610ea56f89214118a02e612a70dc0 Signed-off-by: Emma Foley --- .../vnf_generic/vnf/test_sample_vnf.py | 46 ---------------------- .../network_services/vnf_generic/vnf/sample_vnf.py | 44 --------------------- 2 files changed, 90 deletions(-) diff --git a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py index 26bd1dadd..eb59c2837 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py @@ -1661,42 +1661,6 @@ class TestSampleVnf(unittest.TestCase): # test the default resource helper is MyResourceHelper, not subclass self.assertEqual(type(sample_vnf.resource_helper), MyResourceHelper) - def test__get_port0localip6(self): - sample_vnf = SampleVNF('vnf1', self.VNFD_0) - expected = '0064:ff9b:0:0:0:0:9810:6414' - result = sample_vnf._get_port0localip6() - self.assertEqual(result, expected) - - def test__get_port1localip6(self): - sample_vnf = SampleVNF('vnf1', self.VNFD_0) - expected = '0064:ff9b:0:0:0:0:9810:2814' - result = sample_vnf._get_port1localip6() - self.assertEqual(result, expected) - - def test__get_port0prefixip6(self): - sample_vnf = SampleVNF('vnf1', self.VNFD_0) - expected = '112' - result = sample_vnf._get_port0prefixlen6() - self.assertEqual(result, expected) - - def test__get_port1prefixip6(self): - sample_vnf = SampleVNF('vnf1', self.VNFD_0) - expected = '112' - result = sample_vnf._get_port1prefixlen6() - self.assertEqual(result, expected) - - def test__get_port0gateway6(self): - sample_vnf = SampleVNF('vnf1', self.VNFD_0) - expected = '0064:ff9b:0:0:0:0:9810:6414' - result = sample_vnf._get_port0gateway6() - self.assertEqual(result, expected) - - def test__get_port1gateway6(self): - sample_vnf = SampleVNF('vnf1', self.VNFD_0) - expected = '0064:ff9b:0:0:0:0:9810:2814' - result = sample_vnf._get_port1gateway6() - self.assertEqual(result, expected) - @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.Process') def test__start_vnf(self, *args): vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] @@ -1785,16 +1749,6 @@ class TestSampleVnf(unittest.TestCase): self.assertEqual(sample_vnf.wait_for_instantiate(), 0) - def test__build_ports(self): - vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] - sample_vnf = SampleVNF('vnf1', vnfd) - - self.assertIsNone(sample_vnf._build_ports()) - self.assertIsNotNone(sample_vnf.networks) - self.assertIsNotNone(sample_vnf.uplink_ports) - self.assertIsNotNone(sample_vnf.downlink_ports) - self.assertIsNotNone(sample_vnf.my_ports) - @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time") def test_vnf_execute_with_queue_data(self, *args): queue_size_list = [ diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py index 77488c479..d8b9625fb 100644 --- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py +++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py @@ -35,7 +35,6 @@ from yardstick.common import utils from yardstick.network_services import constants from yardstick.network_services.helpers.dpdkbindnic_helper import DpdkBindHelper, DpdkNode from yardstick.network_services.helpers.samplevnf_helper import MultiPortConfig -from yardstick.network_services.helpers.samplevnf_helper import PortPairs from yardstick.network_services.nfvi.resource import ResourceProfile from yardstick.network_services.utils import get_nsb_option from yardstick.network_services.vnf_generic.vnf.base import GenericTrafficGen @@ -657,49 +656,6 @@ class SampleVNF(GenericVNF): self.vnf_port_pairs = None self._vnf_process = None - def _build_ports(self): - self._port_pairs = PortPairs(self.vnfd_helper.interfaces) - self.networks = self._port_pairs.networks - self.uplink_ports = self.vnfd_helper.port_nums(self._port_pairs.uplink_ports) - self.downlink_ports = self.vnfd_helper.port_nums(self._port_pairs.downlink_ports) - self.my_ports = self.vnfd_helper.port_nums(self._port_pairs.all_ports) - - def _get_route_data(self, route_index, route_type): - route_iter = iter(self.vnfd_helper.vdu0.get('nd_route_tbl', [])) - for _ in range(route_index): - next(route_iter, '') - return next(route_iter, {}).get(route_type, '') - - def _get_port0localip6(self): - return_value = self._get_route_data(0, 'network') - LOG.info("_get_port0localip6 : %s", return_value) - return return_value - - def _get_port1localip6(self): - return_value = self._get_route_data(1, 'network') - LOG.info("_get_port1localip6 : %s", return_value) - return return_value - - def _get_port0prefixlen6(self): - return_value = self._get_route_data(0, 'netmask') - LOG.info("_get_port0prefixlen6 : %s", return_value) - return return_value - - def _get_port1prefixlen6(self): - return_value = self._get_route_data(1, 'netmask') - LOG.info("_get_port1prefixlen6 : %s", return_value) - return return_value - - def _get_port0gateway6(self): - return_value = self._get_route_data(0, 'network') - LOG.info("_get_port0gateway6 : %s", return_value) - return return_value - - def _get_port1gateway6(self): - return_value = self._get_route_data(1, 'network') - LOG.info("_get_port1gateway6 : %s", return_value) - return return_value - def _start_vnf(self): self.queue_wrapper = QueueFileWrapper(self.q_in, self.q_out, self.VNF_PROMPT) name = "{}-{}-{}".format(self.name, self.APP_NAME, os.getpid()) -- cgit 1.2.3-korg