def test_convert_to_nsx_transport_zones_with_bindings(self):
     binding_1 = nsx_models.TzNetworkBinding('whatever',
                                             utils.NetworkTypes.VLAN,
                                             'whatever_tz_1', 66)
     binding_2 = nsx_models.TzNetworkBinding('whatever',
                                             utils.NetworkTypes.STT,
                                             'whatever_tz_2', None)
     results = nsx_utils.convert_to_nsx_transport_zones(
         'meh_zone_uuid', None, bindings=[binding_1, binding_2])
     self._verify_nsx_transport_zones(results)
Exemple #2
0
def add_network_binding(session, network_id, binding_type, phy_uuid, vlan_id):
    with session.begin(subtransactions=True):
        binding = nsx_models.TzNetworkBinding(network_id, binding_type,
                                              phy_uuid, vlan_id)
        session.add(binding)
    return binding