use of org.onosproject.cfg.ComponentConfigService in project onos by opennetworkinglab.
the class OpticalCircuitIntentCompilerTest method setUp.
@Before
public void setUp() {
sut = new OpticalCircuitIntentCompiler();
coreService = createMock(CoreService.class);
expect(coreService.registerApplication("org.onosproject.net.intent")).andReturn(appId);
sut.coreService = coreService;
sut.deviceService = new MockDeviceService();
sut.resourceService = new MockResourceService();
sut.intentService = new TestIntentService();
sut.intentSetMultimap = new MockIntentSetMultimap();
super.setUp();
intentExtensionService = createMock(IntentExtensionService.class);
intentExtensionService.registerCompiler(OpticalCircuitIntent.class, sut);
intentExtensionService.unregisterCompiler(OpticalCircuitIntent.class);
sut.intentManager = intentExtensionService;
replay(coreService, intentExtensionService);
// mocking ComponentConfigService
ComponentConfigService mockConfigService = EasyMock.createMock(ComponentConfigService.class);
expect(mockConfigService.getProperties(anyObject())).andReturn(ImmutableSet.of());
mockConfigService.registerProperties(sut.getClass());
expectLastCall();
mockConfigService.unregisterProperties(sut.getClass(), false);
expectLastCall();
expect(mockConfigService.getProperties(anyObject())).andReturn(ImmutableSet.of());
sut.cfgService = mockConfigService;
replay(mockConfigService);
}
use of org.onosproject.cfg.ComponentConfigService in project onos by opennetworkinglab.
the class OpenstackManagementWebResource method configStatefulSnatBase.
private void configStatefulSnatBase(boolean snatFlag) {
ComponentConfigService service = get(ComponentConfigService.class);
String snatComponent = OpenstackRoutingSnatHandler.class.getName();
service.setProperty(snatComponent, USE_STATEFUL_SNAT_NAME, String.valueOf(snatFlag));
}
use of org.onosproject.cfg.ComponentConfigService in project onos by opennetworkinglab.
the class OpenstackManagementWebResource method configArpModeBase.
private void configArpModeBase(String arpMode) {
ComponentConfigService service = get(ComponentConfigService.class);
String switchingComponent = OpenstackSwitchingArpHandler.class.getName();
String routingComponent = OpenstackRoutingArpHandler.class.getName();
service.setProperty(switchingComponent, ARP_MODE_NAME, arpMode);
service.setProperty(routingComponent, ARP_MODE_NAME, arpMode);
}
use of org.onosproject.cfg.ComponentConfigService in project onos by opennetworkinglab.
the class OpenstackManagementWebResource method configStatefulSnat.
/**
* Configures the stateful SNAT flag (enable | disable).
*
* @param statefulSnat stateful SNAT flag
* @return 200 OK with config result, 404 not found
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("config/statefulSnat/{statefulSnat}")
public Response configStatefulSnat(@PathParam("statefulSnat") String statefulSnat) {
String statefulSnatStr = nullIsIllegal(statefulSnat, STATEFUL_SNAT_REQUIRED);
boolean flag = checkActivationFlag(statefulSnatStr);
configStatefulSnatBase(flag);
ComponentConfigService service = get(ComponentConfigService.class);
String snatComponent = OpenstackRoutingSnatHandler.class.getName();
while (true) {
boolean snatValue = getPropertyValueAsBoolean(service.getProperties(snatComponent), USE_STATEFUL_SNAT_NAME);
if (flag == snatValue) {
break;
}
}
purgeRulesBase();
syncRulesBase();
return ok(mapper().createObjectNode()).build();
}
use of org.onosproject.cfg.ComponentConfigService in project onos by opennetworkinglab.
the class OpenstackManagementWebResource method configSecurityGroup.
/**
* Configures the security group (enable | disable).
*
* @param securityGroup security group activation flag
* @return 200 OK with config result, 404 not found
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("config/securityGroup/{securityGroup}")
public Response configSecurityGroup(@PathParam("securityGroup") String securityGroup) {
String securityGroupStr = nullIsIllegal(securityGroup, SECURITY_GROUP_FLAG_REQUIRED);
boolean flag = checkActivationFlag(securityGroupStr);
ComponentConfigService service = get(ComponentConfigService.class);
String securityGroupComponent = OpenstackSecurityGroupHandler.class.getName();
service.setProperty(securityGroupComponent, USE_SECURITY_GROUP_NAME, String.valueOf(flag));
return ok(mapper().createObjectNode()).build();
}
Aggregations