コード例 #1
0
    def add_dhcp_trap(self, intf_id, onu_id, priority, classifier, action):

        self.log.debug('add dhcp upstream trap',
                       classifier=classifier,
                       action=action)

        action.clear()
        action['trap_to_host'] = True
        classifier['pkt_tag_type'] = 'single_tag'
        classifier.pop('vlan_vid', None)

        gemport_id = platform.mk_gemport_id(onu_id)
        flow_id = platform.mk_flow_id(intf_id, onu_id, DHCP_FLOW_INDEX)

        upstream_flow = openolt_pb2.Flow(
            onu_id=onu_id,
            flow_id=flow_id,
            flow_type="upstream",
            access_intf_id=intf_id,
            network_intf_id=0,
            gemport_id=gemport_id,
            priority=priority,
            classifier=self.mk_classifier(classifier),
            action=self.mk_action(action))

        self.stub.FlowAdd(upstream_flow)

        # FIXME - Fix OpenOLT handling of downstream flows instead
        #         of duplicating the downstream flow from the upstream
        #         flow.
        # FIXME - ONOS should send explicit upstream and downstream
        #         exact dhcp trap flow.
        classifier['udp_src'] = 67
        classifier['udp_dst'] = 68
        classifier['pkt_tag_type'] = 'double_tag'
        action.pop('push_vlan', None)

        flow_id = platform.mk_flow_id(intf_id, onu_id,
                                      DHCP_DOWNLINK_FLOW_INDEX)

        downstream_flow = openolt_pb2.Flow(
            onu_id=onu_id,
            flow_id=flow_id,
            flow_type="downstream",
            access_intf_id=intf_id,
            network_intf_id=0,
            gemport_id=gemport_id,
            priority=priority,
            classifier=self.mk_classifier(classifier),
            action=self.mk_action(action))

        self.log.debug('add dhcp downstream trap',
                       access_intf_id=intf_id,
                       onu_id=onu_id,
                       flow_id=flow_id)
        self.stub.FlowAdd(downstream_flow)
コード例 #2
0
ファイル: openolt_flow_mgr.py プロジェクト: cboling/voltha
    def add_dhcp_trap(self, intf_id, onu_id, classifier, action, logical_flow):

        self.log.debug('add dhcp upstream trap',
                       classifier=classifier,
                       action=action)

        action.clear()
        action['trap_to_host'] = True
        classifier['pkt_tag_type'] = 'single_tag'
        classifier.pop('vlan_vid', None)

        gemport_id = platform.mk_gemport_id(intf_id, onu_id)
        flow_id = platform.mk_flow_id(intf_id, onu_id, DHCP_FLOW_INDEX)

        upstream_flow = openolt_pb2.Flow(
            onu_id=onu_id,
            flow_id=flow_id,
            flow_type="upstream",
            access_intf_id=intf_id,
            gemport_id=gemport_id,
            priority=logical_flow.priority,
            classifier=self.mk_classifier(classifier),
            action=self.mk_action(action))

        self.add_flow_to_device(upstream_flow, logical_flow)

        # FIXME - ONOS should send explicit upstream and downstream
        #         exact dhcp trap flow.

        downstream_logical_flow = copy.deepcopy(logical_flow)
        for oxm_field in downstream_logical_flow.match.oxm_fields:
            if oxm_field.ofb_field.type == OFPXMT_OFB_IN_PORT:
                oxm_field.ofb_field.port = 128

        classifier['udp_src'] = 67
        classifier['udp_dst'] = 68
        classifier['pkt_tag_type'] = 'double_tag'
        action.pop('push_vlan', None)

        flow_id = platform.mk_flow_id(intf_id, onu_id,
                                      DHCP_DOWNLINK_FLOW_INDEX)

        downstream_flow = openolt_pb2.Flow(
            onu_id=onu_id,
            flow_id=flow_id,
            flow_type="downstream",
            access_intf_id=intf_id,
            network_intf_id=0,
            gemport_id=gemport_id,
            priority=logical_flow.priority,
            classifier=self.mk_classifier(classifier),
            action=self.mk_action(action))

        self.add_flow_to_device(downstream_flow, downstream_logical_flow)
コード例 #3
0
    def add_hsia_flow(self, intf_id, onu_id, uplink_classifier, uplink_action,
                downlink_classifier, downlink_action, hsia_id):

        gemport_id = platform.mk_gemport_id(onu_id)
        flow_id = platform.mk_flow_id(intf_id, onu_id, hsia_id)

        self.log.debug('add upstream flow', onu_id=onu_id, classifier=uplink_classifier,
                action=uplink_action, gemport_id=gemport_id, flow_id=flow_id)

        flow = openolt_pb2.Flow(
                onu_id=onu_id, flow_id=flow_id, flow_type="upstream",
                access_intf_id=intf_id, gemport_id=gemport_id,
                classifier=self.mk_classifier(uplink_classifier), action=self.mk_action(uplink_action))


        self.stub.FlowAdd(flow)

        self.log.debug('add downstream flow', classifier=downlink_classifier,
                action=downlink_action, gemport_id=gemport_id, flow_id=flow_id)

        flow = openolt_pb2.Flow(
                onu_id=onu_id, flow_id=flow_id, flow_type="downstream",
                access_intf_id=intf_id, gemport_id=gemport_id,
                classifier=self.mk_classifier(downlink_classifier),
                action=self.mk_action(downlink_action))

        self.stub.FlowAdd(flow)
コード例 #4
0
    def add_eapol_flow(self, intf_id, onu_id, uplink_classifier, uplink_action,
            uplink_eapol_id=EAPOL_FLOW_INDEX,
            downlink_eapol_id=EAPOL_DOWNLINK_FLOW_INDEX,
            vlan_id=DEFAULT_MGMT_VLAN):

        self.log.debug('add eapol flow', classifier=uplink_classifier, action=uplink_action)

        downlink_classifier = dict(uplink_classifier)
        downlink_action = dict(uplink_action)

        gemport_id = platform.mk_gemport_id(onu_id)
        uplink_flow_id = platform.mk_flow_id(intf_id, onu_id, uplink_eapol_id)

        # Add Upstream EAPOL Flow.
        uplink_classifier['pkt_tag_type'] = 'single_tag'
        uplink_classifier['vlan_vid'] = vlan_id
        uplink_action.clear()
        uplink_action['trap_to_host'] = True

        upstream_flow = openolt_pb2.Flow(
                onu_id=onu_id, flow_id=uplink_flow_id, flow_type="upstream",
                access_intf_id=intf_id,gemport_id=gemport_id,
                classifier=self.mk_classifier(uplink_classifier), action=self.mk_action(uplink_action))

        self.stub.FlowAdd(upstream_flow)

        # Add Downstream EAPOL Flow.
        downlink_flow_id = platform.mk_flow_id(intf_id, onu_id, downlink_eapol_id)
        downlink_classifier['pkt_tag_type'] = 'single_tag'
        downlink_classifier['vlan_vid'] = vlan_id

        downstream_flow = openolt_pb2.Flow(
                onu_id=onu_id, flow_id=downlink_flow_id, flow_type="downstream",
                access_intf_id=intf_id, gemport_id=gemport_id,
                classifier=self.mk_classifier(downlink_classifier), action=self.mk_action(downlink_action))


        self.stub.FlowAdd(downstream_flow)
コード例 #5
0
ファイル: openolt_flow_mgr.py プロジェクト: cboling/voltha
    def add_hsia_flow(self, intf_id, onu_id, classifier, action, direction,
                      hsia_id, logical_flow):

        gemport_id = platform.mk_gemport_id(intf_id, onu_id)
        flow_id = platform.mk_flow_id(intf_id, onu_id, hsia_id)

        flow = openolt_pb2.Flow(onu_id=onu_id,
                                flow_id=flow_id,
                                flow_type=direction,
                                access_intf_id=intf_id,
                                gemport_id=gemport_id,
                                priority=logical_flow.priority,
                                classifier=self.mk_classifier(classifier),
                                action=self.mk_action(action))

        self.add_flow_to_device(flow, logical_flow)
コード例 #6
0
    def add_dhcp_trap(self, intf_id, onu_id, classifier, action):

        self.log.debug('add dhcp trap', classifier=classifier, action=action)

        action.clear()
        action['trap_to_host'] = True
        classifier['pkt_tag_type'] = 'single_tag'
        classifier.pop('vlan_vid', None)

        gemport_id = platform.mk_gemport_id(onu_id)
        flow_id = platform.mk_flow_id(intf_id, onu_id, DHCP_FLOW_INDEX)

        upstream_flow = openolt_pb2.Flow(
                onu_id=onu_id, flow_id=flow_id, flow_type="upstream",
                access_intf_id=intf_id, gemport_id=gemport_id,
                classifier=self.mk_classifier(classifier), action=self.mk_action(action))

        self.stub.FlowAdd(upstream_flow)
コード例 #7
0
ファイル: openolt_flow_mgr.py プロジェクト: cboling/voltha
    def add_eapol_flow(self,
                       intf_id,
                       onu_id,
                       logical_flow,
                       uplink_eapol_id=EAPOL_FLOW_INDEX,
                       downlink_eapol_id=EAPOL_DOWNLINK_FLOW_INDEX,
                       vlan_id=DEFAULT_MGMT_VLAN):

        downlink_classifier = {}
        downlink_classifier['eth_type'] = EAP_ETH_TYPE
        downlink_classifier['pkt_tag_type'] = 'single_tag'
        downlink_classifier['vlan_vid'] = vlan_id

        downlink_action = {}
        downlink_action['push_vlan'] = True
        downlink_action['vlan_vid'] = vlan_id

        uplink_classifier = {}
        uplink_classifier['eth_type'] = EAP_ETH_TYPE
        uplink_classifier['pkt_tag_type'] = 'single_tag'
        uplink_classifier['vlan_vid'] = vlan_id

        uplink_action = {}
        uplink_action['trap_to_host'] = True

        gemport_id = platform.mk_gemport_id(intf_id, onu_id)

        # Add Upstream EAPOL Flow.

        uplink_flow_id = platform.mk_flow_id(intf_id, onu_id, uplink_eapol_id)

        upstream_flow = openolt_pb2.Flow(
            onu_id=onu_id,
            flow_id=uplink_flow_id,
            flow_type="upstream",
            access_intf_id=intf_id,
            gemport_id=gemport_id,
            priority=logical_flow.priority,
            classifier=self.mk_classifier(uplink_classifier),
            action=self.mk_action(uplink_action))

        logical_flow = copy.deepcopy(logical_flow)
        logical_flow.match.oxm_fields.extend(
            fd.mk_oxm_fields([fd.vlan_vid(vlan_id | 0x1000)]))
        logical_flow.match.type = OFPMT_OXM

        self.add_flow_to_device(upstream_flow, logical_flow)

        # Add Downstream EAPOL Flow.
        downlink_flow_id = platform.mk_flow_id(intf_id, onu_id,
                                               downlink_eapol_id)

        downstream_flow = openolt_pb2.Flow(
            onu_id=onu_id,
            flow_id=downlink_flow_id,
            flow_type="downstream",
            access_intf_id=intf_id,
            gemport_id=gemport_id,
            priority=logical_flow.priority,
            classifier=self.mk_classifier(downlink_classifier),
            action=self.mk_action(downlink_action))

        downstream_logical_flow = ofp_flow_stats(
            id=logical_flow.id,
            cookie=logical_flow.cookie,
            table_id=logical_flow.table_id,
            priority=logical_flow.priority,
            flags=logical_flow.flags)

        downstream_logical_flow.match.oxm_fields.extend(
            fd.mk_oxm_fields([
                fd.in_port(fd.get_out_port(logical_flow)),
                fd.eth_type(EAP_ETH_TYPE),
                fd.vlan_vid(vlan_id | 0x1000)
            ]))
        downstream_logical_flow.match.type = OFPMT_OXM

        downstream_logical_flow.instructions.extend(
            fd.mk_instructions_from_actions(
                [fd.output(platform.mk_uni_port_num(intf_id, onu_id))]))

        self.add_flow_to_device(downstream_flow, downstream_logical_flow)
コード例 #8
0
    def add_eapol_flow(self,
                       intf_id,
                       onu_id,
                       uplink_eapol_id=EAPOL_FLOW_INDEX,
                       downlink_eapol_id=EAPOL_DOWNLINK_FLOW_INDEX,
                       vlan_id=DEFAULT_MGMT_VLAN):

        # self.log.debug('add eapol flow pre-process',
        #                classifier=uplink_classifier)
        #                #action=uplink_action)

        downlink_classifier = {}
        downlink_classifier['eth_type'] = EAP_ETH_TYPE
        downlink_classifier['pkt_tag_type'] = 'single_tag'
        downlink_classifier['vlan_vid'] = vlan_id

        downlink_action = {}
        downlink_action['push_vlan'] = True
        downlink_action['vlan_vid'] = vlan_id

        uplink_classifier = {}
        uplink_classifier['eth_type'] = EAP_ETH_TYPE
        uplink_classifier['pkt_tag_type'] = 'single_tag'
        uplink_classifier['vlan_vid'] = vlan_id

        uplink_action = {}
        uplink_action['trap_to_host'] = True

        gemport_id = platform.mk_gemport_id(onu_id)

        self.log.debug('add eapol flow',
                       uplink_classifier=uplink_classifier,
                       uplink_action=uplink_action,
                       downlink_classifier=downlink_classifier,
                       downlink_action=downlink_action)
        # Add Upstream EAPOL Flow.

        uplink_flow_id = platform.mk_flow_id(intf_id, onu_id, uplink_eapol_id)

        upstream_flow = openolt_pb2.Flow(
            onu_id=onu_id,
            flow_id=uplink_flow_id,
            flow_type="upstream",
            access_intf_id=intf_id,
            gemport_id=gemport_id,
            classifier=self.mk_classifier(uplink_classifier),
            action=self.mk_action(uplink_action))

        self.stub.FlowAdd(upstream_flow)

        # Add Downstream EAPOL Flow.
        downlink_flow_id = platform.mk_flow_id(intf_id, onu_id,
                                               downlink_eapol_id)

        downstream_flow = openolt_pb2.Flow(
            onu_id=onu_id,
            flow_id=downlink_flow_id,
            flow_type="downstream",
            access_intf_id=intf_id,
            gemport_id=gemport_id,
            classifier=self.mk_classifier(downlink_classifier),
            action=self.mk_action(downlink_action))

        self.stub.FlowAdd(downstream_flow)

        self.log.debug('eap flows',
                       upstream_flow=upstream_flow,
                       downstream_flow=downstream_flow)