def enable_taas(self):

        # Extract the ports for the requested VDU network ifaces
        ntwInterfaces = []
        diagsDict = dict()
        for vdu in self.taas_data.keys():
            vduInfo = utils.getVdu(self.nsInfo, vdu)
            if vduInfo:
                utils.getVduParameter(vduInfo[0], self.taas_data[vdu]).update({"name": vdu})
                ntwIF = utils.getVduParameter(vduInfo[0], self.taas_data[vdu])
                ntwInterfaces.append(ntwIF)
                diagsDict[ntwIF["ips"]] = {"name": vdu, "interface": self.taas_data[vdu]}

        portsList = []
        for interface in ntwInterfaces:
            portID = self._get_port_ID(interface)
            portsList.append(portID)

        # Create tap service on DPDK in-port
        tapServiceParams = {
            "tap_service": {
                "description": "Tap service for diagnostic",
                "name": "Diagnostics",
                "network_id": "b5878681-83eb-44a3-84c2-169934bd879c",
                "port_id": "948448ed-337e-4789-81e3-7da2a6cc2217",
            }
        }
        tapSvcData = self.API.__create_tap_service__(tapServiceParams)
        self.tapServiceID = tapSvcData["tap_service"]["id"]
        print tapSvcData

        # Create tap flows for all the requested vdu network interfaces
        for port in portsList:
            tapFlowParams = {
                "tap_flow": {
                    "description": "Test_flow1",
                    "direction": "BOTH",
                    "name": "flow" + port[:8],
                    "source_port": port,
                    "tap_service_id": tapSvcData["tap_service"]["id"],
                }
            }
            tapFlowData = self.API.__create_tap_flow__(tapFlowParams)
            print tapFlowData
            self.tapFlows.append(tapFlowData["tap_flow"]["id"])

        startAnalyser = requests.get("http://60.0.0.11:9999/startDPI")
Beispiel #2
0
    def _enable_taas(self, service):

        # Extract the ports for the requested VDU network ifaces
        ntwInterfaces = []
        # self.diagsDict = {}
        for ns in self.taas_data.keys():
            if ns == service["id"]:
                for vdu in self.taas_data[ns].keys():
                    vduInfo = utils.getVdu(service, vdu)
                    if vduInfo:
                        utils.getVduParameter(vduInfo[0], self.taas_data[ns][vdu]).update({"name": vdu})
                        ntwIF = utils.getVduParameter(vduInfo[0], self.taas_data[ns][vdu])
                        ntwInterfaces.append(ntwIF)

        portsList = []
        for interface in ntwInterfaces:
            portID = self._get_port_ID(interface)
            portsList.append(portID)

        # Create tap service on DPDK in-port
        tapServiceParams = {
            "tap_service": {
                "description": "Tap service for diagnostic",
                "name": "Diagnostics",
                "network_id": "f3200048-6c40-470e-86ec-239100d58d11",
                "port_id": "34ec955d-4f11-47e2-893a-dcd957cbed22",
            }
        }
        tapSvcData = self.API.__create_tap_service__(tapServiceParams)
        self.tapServices.append(tapSvcData["tap_service"]["id"])
        print tapSvcData

        # Create tap flows for all the requested vdu network interfaces
        for port in portsList:
            tapFlowParams = {
                "tap_flow": {
                    "description": "Test_flow1",
                    "direction": "BOTH",
                    "name": "flow" + port[:8],
                    "source_port": port,
                    "tap_service_id": tapSvcData["tap_service"]["id"],
                }
            }
            tapFlowData = self.API.__create_tap_flow__(tapFlowParams)
            print tapFlowData
            self.tapFlows.append(tapFlowData["tap_flow"]["id"])