@Override
    public void applyFlowRule(NetworkId networkId, FlowRule... flowRules) {
        for (FlowRule flowRule : flowRules) {
            devirtualize(networkId, flowRule).forEach(
                    r -> flowRuleService.applyFlowRules(r));
        }
    }
@Test
    public void devirtualizeFlowRuleWithoutInPort() {
        TrafficSelector ts = DefaultTrafficSelector.builder().build();
        TrafficTreatment tr = DefaultTrafficTreatment.builder()
                .setOutput(PORT_NUM2).build();

        FlowRule r1 = DefaultFlowRule.builder()
                .forDevice(VDID)
                .withSelector(ts)
                .withTreatment(tr)
                .withPriority(10)
                .fromApp(vAppId)
                .makeTemporary(TIMEOUT)
                .build();

        virtualProvider.applyFlowRule(VNET_ID, r1);

        assertEquals("3 rules should exist", 3,
                     virtualProvider.flowRuleService.getFlowRuleCount());

        FlowRule inFromDID1 = null;
        FlowRule inFromDID2 = null;
        FlowRule out = null;

        Set<FlowEntry> phyRules = new HashSet<>();
        for (FlowEntry i : virtualProvider.flowRuleService.getFlowEntries(DID1)) {
            phyRules.add(i);
        }
        for (FlowEntry i : virtualProvider.flowRuleService.getFlowEntries(DID2)) {
            phyRules.add(i);
        }

        for (FlowRule rule : phyRules) {
            for (Instruction inst : rule.treatment().allInstructions()) {
                if (inst.type() == Instruction.Type.L2MODIFICATION) {
                    L2ModificationInstruction i = (L2ModificationInstruction) inst;
                    if (i.subtype() == L2ModificationInstruction.L2SubType.VLAN_PUSH) {
                        inFromDID1 = rule;
                        break;
                    } else {
                        out = rule;
                        break;
                    }
                } else {
                    inFromDID2 = rule;
                    break;
                }
            }
        }

        assertEquals(DID1, inFromDID1.deviceId());
        assertEquals(DID2, inFromDID2.deviceId());
        assertEquals(DID2, out.deviceId());
    }