def test_get_service_ports(self): service = { 'spec': { 'ports': [{ 'port': 1, 'targetPort': 1 }, { 'port': 2, 'name': 'X', 'protocol': 'UDP', 'targetPort': 2 }] } } expected_ret = [{ 'port': 1, 'name': None, 'protocol': 'TCP', 'targetPort': '1' }, { 'port': 2, 'name': 'X', 'protocol': 'UDP', 'targetPort': '2' }] ret = utils.get_service_ports(service) self.assertEqual(expected_ret, ret)
def _generate_lbaas_port_specs(self, service): return [ obj_lbaas.LBaaSPortSpec(**port) for port in utils.get_service_ports(service) ]