protected void initializePipeline() {
        // Set up rules for packet-out forwarding. We support only IPv4 routing.
        final long cpuPort = capabilities.cpuPort().get();
        flowRuleService.applyFlowRules(
                ingressVlanRule(cpuPort, false, DEFAULT_VLAN),
                fwdClassifierRule(cpuPort, null, Ethernet.TYPE_IPV4, FWD_IPV4_ROUTING,
                        DEFAULT_FLOW_PRIORITY));
    }
@Test
    public void testInitializePipeline() {
        final Capture<FlowRule> capturedCpuIgVlanRule = newCapture(CaptureType.ALL);
        final Capture<FlowRule> capturedCpuFwdClsRule = newCapture(CaptureType.ALL);

        // ingress_port_vlan table for cpu port
        final TrafficSelector cpuIgVlanSelector = DefaultTrafficSelector.builder()
                .add(Criteria.matchInPort(PortNumber.portNumber(CPU_PORT)))
                .add(PiCriterion.builder()
                        .matchExact(FabricConstants.HDR_VLAN_IS_VALID, ZERO)
                        .build())
                .build();
        final TrafficTreatment cpuIgVlanTreatment = DefaultTrafficTreatment.builder()
                .piTableAction(PiAction.builder()
                        .withId(FabricConstants.FABRIC_INGRESS_FILTERING_PERMIT_WITH_INTERNAL_VLAN)
                        .withParameter(new PiActionParam(FabricConstants.VLAN_ID, DEFAULT_VLAN))
                        .withParameter(new PiActionParam(FabricConstants.PORT_TYPE, PORT_TYPE_INTERNAL))
                        .build())
                .build();
        final FlowRule expectedCpuIgVlanRule = DefaultFlowRule.builder()
                .withSelector(cpuIgVlanSelector)
                .withTreatment(cpuIgVlanTreatment)
                .forTable(FabricConstants.FABRIC_INGRESS_FILTERING_INGRESS_PORT_VLAN)
                .makePermanent()
                .withPriority(DEFAULT_FLOW_PRIORITY)
                .forDevice(DEVICE_ID)
                .fromApp(APP_ID)
                .build();

        final TrafficSelector cpuFwdClsSelector = DefaultTrafficSelector.builder()
                .matchInPort(PortNumber.portNumber(CPU_PORT))
                .matchPi(PiCriterion.builder()
                        .matchExact(FabricConstants.HDR_IP_ETH_TYPE, Ethernet.TYPE_IPV4)
                        .build())
                .build();
        final TrafficTreatment cpuFwdClsTreatment = DefaultTrafficTreatment.builder()
                .piTableAction(PiAction.builder()
                        .withId(FabricConstants.FABRIC_INGRESS_FILTERING_SET_FORWARDING_TYPE)
                        .withParameter(new PiActionParam(FabricConstants.FWD_TYPE, FWD_IPV4_ROUTING))
                        .build())
                .build();
        final FlowRule expectedCpuFwdClsRule = DefaultFlowRule.builder()
                .withSelector(cpuFwdClsSelector)
                .withTreatment(cpuFwdClsTreatment)
                .forTable(FabricConstants.FABRIC_INGRESS_FILTERING_FWD_CLASSIFIER)
                .makePermanent()
                .withPriority(DEFAULT_FLOW_PRIORITY)
                .forDevice(DEVICE_ID)
                .fromApp(APP_ID)
                .build();
        flowRuleService.applyFlowRules(
                capture(capturedCpuIgVlanRule),
                capture(capturedCpuFwdClsRule));

        replay(flowRuleService);
        pipeliner.initializePipeline();

        assertTrue(expectedCpuIgVlanRule.exactMatch(capturedCpuIgVlanRule.getValue()));
        assertTrue(expectedCpuFwdClsRule.exactMatch(capturedCpuFwdClsRule.getValue()));

        verify(flowRuleService);
        reset(flowRuleService);
    }