Hyunsun Moon
Committed by Gerrit Code Review

Added CLI to flush flow rules installed by cordvtn

Might be useful to refresh data plane with most recent status of Neutron
and VMs by flushing all existing rules and pushing network config again
And also removed read configuration during activation since leadership
service does not work as expected during app activation

Change-Id: Ia22fe02d25a61126f3e6df59fc5ad4d065f89f18
......@@ -237,7 +237,6 @@ public class CordVtnNodeManager {
deviceService.addListener(deviceListener);
configService.addListener(configListener);
readConfiguration();
}
@Deactivate
......@@ -315,6 +314,13 @@ public class CordVtnNodeManager {
}
/**
* Flush flows installed by cordvtn.
*/
public void flushRules() {
ruleInstaller.flushRules();
}
/**
* Returns if current node state saved in nodeStore is COMPLETE or not.
*
* @param node cordvtn node
......
......@@ -172,6 +172,13 @@ public class CordVtnRuleInstaller {
}
/**
* Flush flows installed by this application.
*/
public void flushRules() {
flowRuleService.getFlowRulesById(appId).forEach(flowRule -> processFlowRule(false, flowRule));
}
/**
* Populates basic rules that connect a VM to the other VMs in the system.
*
* @param host host
......
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.cordvtn.cli;
import org.apache.karaf.shell.commands.Command;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.cordvtn.CordVtnNodeManager;
/**
* Deletes nodes from the service.
*/
@Command(scope = "onos", name = "cordvtn-flush-rules",
description = "Flush flow rules installed by CORD VTN")
public class CordVtnFlushRules extends AbstractShellCommand {
@Override
protected void execute() {
CordVtnNodeManager nodeManager = AbstractShellCommand.get(CordVtnNodeManager.class);
nodeManager.flushRules();
print("Successfully flushed");
}
}
......@@ -28,5 +28,8 @@
<command>
<action class="org.onosproject.cordvtn.cli.CordVtnNodeCheckCommand"/>
</command>
<command>
<action class="org.onosproject.cordvtn.cli.CordVtnFlushRules"/>
</command>
</command-bundle>
</blueprint>
......