use of org.onosproject.cfg.ComponentConfigService in project onos by opennetworkinglab.
the class CreateFlows method doExecute.
@Override
protected void doExecute() {
ComponentConfigService service = get(ComponentConfigService.class);
service.setProperty("org.onosproject.routescale.ScaleTestManager", "flowCount", String.valueOf(flowCount));
}
use of org.onosproject.cfg.ComponentConfigService in project onos by opennetworkinglab.
the class OpenFlowControllerImplTest method setUp.
/**
* Sets up switches to use as data, mocks and launches a controller instance.
*/
@Before
public void setUp() {
try {
switch1 = new OpenflowSwitchDriverAdapter();
dpid1 = Dpid.dpid(new URI("of:0000000000000111"));
switch2 = new OpenflowSwitchDriverAdapter();
dpid2 = Dpid.dpid(new URI("of:0000000000000222"));
switch3 = new OpenflowSwitchDriverAdapter();
dpid3 = Dpid.dpid(new URI("of:0000000000000333"));
} catch (URISyntaxException ex) {
// Does not happen
fail();
}
controller = new OpenFlowControllerImpl();
agent = controller.agent;
switchListener = new TestSwitchListener();
controller.addListener(switchListener);
CoreService mockCoreService = EasyMock.createMock(CoreService.class);
controller.coreService = mockCoreService;
OpenFlowService mockOpenFlowService = EasyMock.createMock(OpenFlowService.class);
controller.openFlowManager = mockOpenFlowService;
ComponentConfigService mockConfigService = EasyMock.createMock(ComponentConfigService.class);
expect(mockConfigService.getProperties(anyObject())).andReturn(ImmutableSet.of());
mockConfigService.registerProperties(controller.getClass());
expectLastCall();
mockConfigService.unregisterProperties(controller.getClass(), false);
expectLastCall();
expect(mockConfigService.getProperties(anyObject())).andReturn(ImmutableSet.of());
controller.cfgService = mockConfigService;
replay(mockConfigService);
NetworkConfigRegistry netConfigService = EasyMock.createMock(NetworkConfigRegistry.class);
controller.netCfgService = netConfigService;
ComponentContext mockContext = EasyMock.createMock(ComponentContext.class);
Dictionary<String, Object> properties = new Hashtable<>();
properties.put("openflowPorts", Integer.toString(EPHEMERAL_PORT));
expect(mockContext.getProperties()).andReturn(properties);
replay(mockContext);
controller.activate(mockContext);
}
use of org.onosproject.cfg.ComponentConfigService in project onos by opennetworkinglab.
the class OpenstackConfigArpModeCommand method doExecute.
@Override
protected void doExecute() {
if (checkArpMode(arpMode)) {
configArpMode(arpMode);
ComponentConfigService service = get(ComponentConfigService.class);
String switchingComponent = OpenstackSwitchingArpHandler.class.getName();
String routingComponent = OpenstackRoutingArpHandler.class.getName();
// reinstall all rules only if the arpMode is changed to the configured one
while (true) {
String switchingValue = getPropertyValue(service.getProperties(switchingComponent), ARP_MODE_NAME);
String routingValue = getPropertyValue(service.getProperties(routingComponent), ARP_MODE_NAME);
if (arpMode.equals(switchingValue) && arpMode.equals(routingValue)) {
break;
}
}
purgeRules();
syncRules();
}
}
use of org.onosproject.cfg.ComponentConfigService in project onos by opennetworkinglab.
the class OpenstackConfigStatefulSnatCommand method configSnatMode.
private void configSnatMode(boolean snatMode) {
ComponentConfigService service = get(ComponentConfigService.class);
String snatComponent = OpenstackRoutingSnatHandler.class.getName();
service.setProperty(snatComponent, USE_STATEFUL_SNAT, String.valueOf(snatMode));
}
use of org.onosproject.cfg.ComponentConfigService in project onos by opennetworkinglab.
the class OpenstackConfigStatefulSnatCommand method doExecute.
@Override
protected void doExecute() {
configSnatMode(statefulSnat);
ComponentConfigService service = get(ComponentConfigService.class);
String snatComponent = OpenstackRoutingSnatHandler.class.getName();
while (true) {
boolean snatValue = getPropertyValueAsBoolean(service.getProperties(snatComponent), USE_STATEFUL_SNAT);
if (statefulSnat == snatValue) {
break;
}
}
purgeRules();
syncRules();
}
Aggregations