@Override
    public void applyFlowRule(NetworkId networkId, FlowRule... flowRules) {
        for (FlowRule flowRule : flowRules) {
            devirtualize(networkId, flowRule).forEach(
                    r -> flowRuleService.applyFlowRules(r));
        }
    }
@Test
    public void devirtualizeFlowRuleWithInPort() {
        TrafficSelector ts = DefaultTrafficSelector.builder()
                .matchInPort(PORT_NUM1).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("2 rules should exist", 2,
                     virtualProvider.flowRuleService.getFlowRuleCount());

        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);
        }

        FlowRule in = null;
        FlowRule out = null;

        for (FlowRule rule : phyRules) {

            L2ModificationInstruction i = (L2ModificationInstruction)
                    rule.treatment().allInstructions().get(0);

            if (i.subtype() == L2ModificationInstruction.L2SubType.VLAN_PUSH) {
                in = rule;
            } else {
                out = rule;
            }

        }

        assertEquals(DID1, in.deviceId());
        assertEquals(DID2, out.deviceId());
    }