@Override
    public void setRule(ApplicationId appId,
                        DeviceId deviceId,
                        TrafficSelector selector,
                        TrafficTreatment treatment,
                        int priority,
                        int tableType,
                        boolean install) {

        FlowRule.Builder flowRuleBuilder = DefaultFlowRule.builder()
                .forDevice(deviceId)
                .withSelector(selector)
                .withTreatment(treatment)
                .withPriority(priority)
                .fromApp(appId)
                .forTable(tableType);

        if (priority == Constants.PRIORITY_SNAT_RULE) {
            flowRuleBuilder.makeTemporary(TIMEOUT_SNAT_RULE);
        } else {
            flowRuleBuilder.makePermanent();
        }

        applyRule(flowRuleBuilder.build(), install);
    }
@Test
    public void testSetRule() {
        int testPriority = 10;
        int testTableType = 10;

        fros = Sets.newConcurrentHashSet();

        TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();
        TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder();

        FlowRule.Builder flowRuleBuilder = DefaultFlowRule.builder()
                .forDevice(DEVICE_ID)
                .withSelector(selectorBuilder.build())
                .withTreatment(treatmentBuilder.build())
                .withPriority(testPriority)
                .fromApp(TEST_APP_ID)
                .forTable(testTableType)
                .makePermanent();

        target.setRule(TEST_APP_ID, DEVICE_ID, selectorBuilder.build(),
                treatmentBuilder.build(), testPriority, testTableType, true);
        validateFlowRule(flowRuleBuilder.build());
    }