use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class DistributedK8sNetworkPolicyStore method activate.
@Activate
protected void activate() {
ApplicationId appId = coreService.registerApplication(APP_ID);
networkPolicyStore = storageService.<String, NetworkPolicy>consistentMapBuilder().withSerializer(Serializer.using(SERIALIZER_K8S_NETWORK_POLICY)).withName("k8s-network-policy-store").withApplicationId(appId).build();
networkPolicyStore.addListener(networkPolicyMapListener);
log.info("Started");
}
use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class DistributedK8sServiceStore method activate.
@Activate
protected void activate() {
ApplicationId appId = coreService.registerApplication(APP_ID);
serviceStore = storageService.<String, Service>consistentMapBuilder().withSerializer(Serializer.using(SERIALIZER_K8S_SERVICE)).withName("k8s-service-store").withApplicationId(appId).build();
serviceStore.addListener(serviceMapListener);
log.info("Started");
}
use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class ReactiveRoutingConfiguration method setUpConfiguration.
/**
* Set up reactive routing information from configuration.
*/
private void setUpConfiguration() {
ReactiveRoutingConfig config = configService.getConfig(coreService.registerApplication(ReactiveRoutingConfigurationService.REACTIVE_ROUTING_APP_ID), ReactiveRoutingConfigurationService.CONFIG_CLASS);
if (config == null) {
log.warn("No reactive routing config available!");
return;
}
for (LocalIpPrefixEntry entry : config.localIp4PrefixEntries()) {
localPrefixTable4.put(createBinaryString(entry.ipPrefix()), entry);
gatewayIpAddresses.add(entry.getGatewayIpAddress());
log.info("adding local IPv4 entry: {} {}", entry.ipPrefix(), entry.getGatewayIpAddress());
}
for (LocalIpPrefixEntry entry : config.localIp6PrefixEntries()) {
localPrefixTable6.put(createBinaryString(entry.ipPrefix()), entry);
gatewayIpAddresses.add(entry.getGatewayIpAddress());
log.info("adding local IPv6 entry: {} {}", entry.ipPrefix(), entry.getGatewayIpAddress());
}
virtualGatewayMacAddress = config.virtualGatewayMacAddress();
log.info("virtual gateway MAC: {}", virtualGatewayMacAddress);
// Setup BGP peer connect points
ApplicationId routerAppId = coreService.getAppId(RoutingService.ROUTER_APP_ID);
if (routerAppId == null) {
log.info("Router application ID is null!");
return;
}
BgpConfig bgpConfig = configService.getConfig(routerAppId, BgpConfig.class);
if (bgpConfig == null) {
log.info("BGP config is null!");
return;
} else {
bgpPeerConnectPoints = bgpConfig.bgpSpeakers().stream().flatMap(speaker -> speaker.peers().stream()).map(peer -> interfaceService.getMatchingInterface(peer)).filter(Objects::nonNull).map(Interface::connectPoint).collect(Collectors.toSet());
}
}
use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class RouteConfigTest method setUp.
@Before
public void setUp() throws Exception {
InputStream jsonStream = RouteConfigTest.class.getResourceAsStream("/route-config.json");
ApplicationId subject = new TestApplicationId(KEY);
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree(jsonStream);
ConfigApplyDelegate delegate = new MockDelegate();
config = new RouteConfig();
config.init(subject, KEY, jsonNode, mapper, delegate);
}
use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class FlowsListCommand method printFlows.
/**
* Prints flows.
*
* @param d the device
* @param flows the set of flows for that device
* @param coreService core system service
*/
protected void printFlows(Device d, List<FlowEntry> flows, CoreService coreService) {
List<FlowEntry> filteredFlows = filterFlows(flows);
boolean empty = filteredFlows == null || filteredFlows.isEmpty();
print("deviceId=%s, flowRuleCount=%d", d.id(), empty ? 0 : filteredFlows.size());
if (empty || countOnly) {
return;
}
for (FlowEntry f : filteredFlows) {
if (shortOutput) {
print(SHORT_FORMAT, f.state(), f.bytes(), f.packets(), f.table(), f.priority(), f.selector().criteria(), printTreatment(f.treatment()));
} else {
ApplicationId appId = coreService.getAppId(f.appId());
print(LONG_FORMAT, Long.toHexString(f.id().value()), f.state(), f.bytes(), f.packets(), f.life(), f.liveType(), f.priority(), f.table(), appId != null ? appId.name() : "<none>", f.selector().criteria(), f.treatment());
}
}
}
Aggregations