コード例 #1
0
 def _attach_policy(self, vn_obj, *policies):
     for policy in policies or []:
         vn_obj.add_network_policy(
             policy, VirtualNetworkPolicyType(sequence=SequenceType(0, 0)))
     self.vnc_lib.virtual_network_update(vn_obj)
     for policy in policies or []:
         self.vnc_lib.ref_relax_for_delete(vn_obj.uuid, policy.uuid)
コード例 #2
0
ファイル: config.py プロジェクト: nuthanc/contrail-test
 def __init__(self, inputs, connections, vn_fixture, policy_fixture, policy_type=None):
     self.inputs = inputs
     self.logger = self.inputs.logger
     self.orch = connections.orch
     self.vnc_lib = connections.vnc_lib
     self.vn_fixture = vn_fixture
     self.policy_fixture = policy_fixture
     self.vn_obj = self.vnc_lib.virtual_network_read(
         fq_name_str=self.vn_fixture.vn_fq_name)
     self.policy_obj = self.vnc_lib.network_policy_read(
         fq_name=self.policy_fixture.policy_fq_name)
     seq = random.randint(1, 655535)
     kwargs = {'sequence': SequenceType(seq, 0)}
     if policy_type == 'dynamic':
         kwargs.update({'timer': TimerType()})
     self.policy_type = VirtualNetworkPolicyType(**kwargs)
コード例 #3
0
    def basic_issu_policy_pre(self):
        vn1_name = self.id() + 'vn1'
        vn2_name = self.id() + 'vn2'
        vn1_obj = VirtualNetwork(vn1_name)
        vn2_obj = VirtualNetwork(vn2_name)

        np = self.create_network_policy(vn1_obj, vn2_obj)
        seq = SequenceType(1, 1)
        vnp = VirtualNetworkPolicyType(seq)
        vn1_obj.set_network_policy(np, vnp)
        vn2_obj.set_network_policy(np, vnp)
        self._vnc_lib.virtual_network_create(vn1_obj)
        self._vnc_lib.virtual_network_create(vn2_obj)

        self.assertTill(self.vnc_db_has_ident, obj=vn1_obj)
        self.assertTill(self.vnc_db_has_ident, obj=vn2_obj)

        self.check_ri_ref_present(self.get_ri_name(vn1_obj),
                                  self.get_ri_name(vn2_obj))
        self.check_ri_ref_present(self.get_ri_name(vn2_obj),
                                  self.get_ri_name(vn1_obj))
コード例 #4
0
def gen_virtual_network_policy():
    """ Returns a configured vnc_api.gen.resource_xsd.VirtualNetworkPolicyType """
    sequence = SequenceType(major=0, minor=0)
    pol = VirtualNetworkPolicyType(sequence=sequence)
    return pol