Ejemplo n.º 1
0
 def _port_pairs_by_lport(self, lport):
     # If port pair uses same port for ingress and egress, we will get it
     # here twice so need to filter out:
     seen = set()
     for port_pair in itertools.chain(
         self.db_store.get_all(
             sfc.PortPair(egress_port=lport),
             index=sfc.PortPair.get_index('egress'),
         ),
         self.db_store.get_all(
             sfc.PortPair(egress_port=lport),
             index=sfc.PortPair.get_index('ingress'),
         ),
     ):
         if port_pair.id not in seen:
             seen.add(port_pair.id)
             yield port_pair
Ejemplo n.º 2
0
    def delete_port_pair_postcommit(self, context):
        port_pair = context.current

        self.nb_api.delete(
            sfc.PortPair(
                id=port_pair['id'],
                topic=port_pair['project_id'],
            ), )
Ejemplo n.º 3
0
    def update_port_pair_postcommit(self, context):
        port_pair = context.current

        self.nb_api.update(
            sfc.PortPair(
                id=port_pair['id'],
                topic=port_pair['project_id'],
                name=port_pair.get('name'),
            ), )
Ejemplo n.º 4
0
 def test_delete_port_pair_postcommit(self):
     self.driver.delete_port_pair_postcommit(
         self._get_pp_ctx(
             id='id1',
             project_id='id2',
         ), )
     self.driver.nb_api.delete.assert_called_once_with(
         sfc.PortPair(
             id='id1',
             topic='id2',
         ), )
Ejemplo n.º 5
0
    def create_port_pair_postcommit(self, context):
        port_pair = context.current
        sf_params = port_pair.get('service_function_parameters', {})

        self.nb_api.create(
            sfc.PortPair(id=port_pair['id'],
                         topic=port_pair['project_id'],
                         name=port_pair.get('name'),
                         ingress_port=port_pair['ingress'],
                         egress_port=port_pair['egress'],
                         correlation_mechanism=(sf_params.get('correlation')
                                                or sfc.CORR_NONE),
                         weight=sf_params.get('weight')), )
Ejemplo n.º 6
0
 def test_create_port_pair_postcommit(self):
     self.driver.create_port_pair_postcommit(
         self._get_pp_ctx(
             id='id1',
             project_id='id2',
             name='name',
             ingress='ingress-id',
             egress='egress-id',
             service_function_parameters={
                 'correlation': 'mpls',
                 'weight': 2,
             },
         ), )
     self.driver.nb_api.create.assert_called_once_with(
         sfc.PortPair(
             id='id1',
             topic='id2',
             name='name',
             ingress_port='ingress-id',
             egress_port='egress-id',
             correlation_mechanism=sfc.CORR_MPLS,
             weight=2,
         ), )
Ejemplo n.º 7
0
    lswitch='lswitch1',
    binding=test_app_base.local_binding,
)

pp12egress = l2.LogicalPort(
    id='pp12egress',
    topic='topic1',
    version=10,
    unique_key=24,
    lswitch='lswitch1',
    binding=test_app_base.local_binding,
)

pp11 = sfc.PortPair(
    id='pp11',
    topic='topic1',
    ingress_port='pp11ingress',
    egress_port='pp11egress',
)

pp21 = sfc.PortPair(
    id='pp21',
    topic='topic1',
    ingress_port='pp11ingress',
    egress_port='pp11egress',
)

pp12 = sfc.PortPair(
    id='pp12',
    topic='topic1',
    ingress_port='pp12ingress',
    egress_port='pp12egress',