org.onosproject.net.intent.IntentService Java Examples
The following examples show how to use
org.onosproject.net.intent.IntentService.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IntentsResourceTest.java From onos with Apache License 2.0 | 6 votes |
/** * Initializes test mocks and environment. */ @Before public void setUpTest() { expect(mockIntentService.getIntents()).andReturn(intents).anyTimes(); expect(mockIntentService.getIntentState(anyObject())) .andReturn(IntentState.INSTALLED) .anyTimes(); // Register the services needed for the test final CodecManager codecService = new CodecManager(); codecService.activate(); ServiceDirectory testDirectory = new TestServiceDirectory() .add(IntentService.class, mockIntentService) .add(FlowRuleService.class, mockFlowService) .add(CodecService.class, codecService) .add(CoreService.class, mockCoreService); setServiceDirectory(testDirectory); MockIdGenerator.cleanBind(); }
Example #2
Source File: ServicesBundle.java From onos with Apache License 2.0 | 6 votes |
/** * Creates the services bundle, from the given directly. * * @param directory service directory */ public ServicesBundle(ServiceDirectory directory) { checkNotNull(directory, "Directory cannot be null"); clusterService = directory.get(ClusterService.class); topologyService = directory.get(TopologyService.class); deviceService = directory.get(DeviceService.class); driverService = directory.get(DriverService.class); hostService = directory.get(HostService.class); linkService = directory.get(LinkService.class); mastershipService = directory.get(MastershipService.class); mastershipAdminService = directory.get(MastershipAdminService.class); intentService = directory.get(IntentService.class); flowService = directory.get(FlowRuleService.class); flowStatsService = directory.get(StatisticService.class); portStatsService = directory.get(PortStatisticsService.class); }
Example #3
Source File: IntentSynchronizerTest.java From onos with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { super.setUp(); setUpConnectPoints(); intentService = EasyMock.createMock(IntentService.class); intentSynchronizer = new TestIntentSynchronizer(); intentSynchronizer.coreService = new TestCoreService(); intentSynchronizer.clusterService = new TestClusterService(); intentSynchronizer.leadershipService = new LeadershipServiceAdapter(); intentSynchronizer.intentService = intentService; intentSynchronizer.activate(); }
Example #4
Source File: Topo2Jsonifier.java From onos with Apache License 2.0 | 6 votes |
/** * Creates an instance with a reference to the services directory, so that * additional information about network elements may be looked up on * on the fly. * * @param directory service directory * @param userName logged in user name */ public Topo2Jsonifier(ServiceDirectory directory, String userName) { this.directory = checkNotNull(directory, "Directory cannot be null"); this.userName = checkNotNull(userName, "User name cannot be null"); clusterService = directory.get(ClusterService.class); deviceService = directory.get(DeviceService.class); linkService = directory.get(LinkService.class); hostService = directory.get(HostService.class); mastershipService = directory.get(MastershipService.class); intentService = directory.get(IntentService.class); flowService = directory.get(FlowRuleService.class); flowStatsService = directory.get(StatisticService.class); portStatsService = directory.get(PortStatisticsService.class); topologyService = directory.get(TopologyService.class); uiextService = directory.get(UiExtensionService.class); prefService = directory.get(UiPreferencesService.class); }
Example #5
Source File: ApplicationIdImrCompleter.java From onos with Apache License 2.0 | 6 votes |
@Override public int complete(Session session, CommandLine commandLine, List<String> candidates) { // Delegate string completer StringsCompleter delegate = new StringsCompleter(); // Fetch our service and feed it's offerings to the string completer IntentService service = AbstractShellCommand.get(IntentService.class); SortedSet<String> strings = delegate.getStrings(); service.getIntents() .forEach(intent -> strings.add(Short.toString(intent.appId().id()))); // Now let the completer do the work for figuring out what to offer. return delegate.complete(session, commandLine, candidates); }
Example #6
Source File: ApplicationIdWithIntentNameCompleter.java From onos with Apache License 2.0 | 6 votes |
@Override public int complete(Session session, CommandLine commandLine, List<String> candidates) { // Delegate string completer StringsCompleter delegate = new StringsCompleter(); // Fetch our service and feed it's offerings to the string completer IntentService service = AbstractShellCommand.get(IntentService.class); SortedSet<String> strings = delegate.getStrings(); service.getIntents() .forEach(intent -> strings.add(intent.appId().name())); // Now let the completer do the work for figuring out what to offer. return delegate.complete(session, commandLine, candidates); }
Example #7
Source File: IntentKeyImrCompleter.java From onos with Apache License 2.0 | 6 votes |
@Override public int complete(Session session, CommandLine commandLine, List<String> candidates) { // Delegate string completer StringsCompleter delegate = new StringsCompleter(); // Fetch our service and feed it's offerings to the string completer IntentService service = AbstractShellCommand.get(IntentService.class); SortedSet<String> strings = delegate.getStrings(); service.getIntents().forEach(intent -> { if (intent instanceof LinkCollectionIntent || intent instanceof PointToPointIntent) { strings.add(intent.key().toString()); } }); // Now let the completer do the work for figuring out what to offer. return delegate.complete(session, commandLine, candidates); }
Example #8
Source File: OpticalIntentsWebResource.java From onos with Apache License 2.0 | 6 votes |
/** * Submits a new optical intent. * Creates and submits optical intents from the JSON request. * * @param stream input JSON * @return status of the request - CREATED if the JSON is correct, * BAD_REQUEST if the JSON is invalid * @onos.rsModel CreateIntent */ @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response createIntent(InputStream stream) { try { IntentService service = get(IntentService.class); ObjectNode root = readTreeFromStream(mapper(), stream); Intent intent = decode(root); service.submit(intent); UriBuilder locationBuilder = uriInfo.getBaseUriBuilder() .path("intents") .path(intent.appId().name()) .path(Long.toString(intent.id().fingerprint())); return Response .created(locationBuilder.build()) .build(); } catch (IOException ioe) { throw new IllegalArgumentException(ioe); } }
Example #9
Source File: OpticalIntentsWebResource.java From onos with Apache License 2.0 | 6 votes |
/** * Delete the specified optical intent. * * @param appId application identifier * @param keyString intent key * @return 204 NO CONTENT */ @DELETE @Consumes(MediaType.APPLICATION_JSON) @Path("{appId}/{key}") public Response deleteIntent(@PathParam("appId") String appId, @PathParam("key") String keyString) { final ApplicationId app = get(CoreService.class).getAppId(appId); nullIsNotFound(app, "Application Id not found"); IntentService intentService = get(IntentService.class); Intent intent = intentService.getIntent(Key.of(keyString, app)); if (intent == null) { intent = intentService.getIntent(Key.of(Long.decode(keyString), app)); } nullIsNotFound(intent, "Intent Id is not found"); if ((intent instanceof OpticalConnectivityIntent) || (intent instanceof OpticalCircuitIntent)) { intentService.withdraw(intent); } else { throw new IllegalArgumentException("Specified intent is not of type OpticalConnectivityIntent"); } return Response.noContent().build(); }
Example #10
Source File: AddHostToHostIntentCommand.java From onos with Apache License 2.0 | 6 votes |
@Override protected void doExecute() { IntentService service = get(IntentService.class); HostId oneId = HostId.hostId(one); HostId twoId = HostId.hostId(two); TrafficSelector selector = buildTrafficSelector(); TrafficTreatment treatment = buildTrafficTreatment(); List<Constraint> constraints = buildConstraints(); HostToHostIntent intent = HostToHostIntent.builder() .appId(appId()) .key(key()) .one(oneId) .two(twoId) .selector(selector) .treatment(treatment) .constraints(constraints) .priority(priority()) .resourceGroup(resourceGroup()) .build(); service.submit(intent); print("Host to Host intent submitted:\n%s", intent.toString()); }
Example #11
Source File: IntentsWebResource.java From onos with Apache License 2.0 | 6 votes |
/** * Submits a new intent. * Creates and submits intent from the JSON request. * * @param stream input JSON * @return status of the request - CREATED if the JSON is correct, * BAD_REQUEST if the JSON is invalid * @onos.rsModel IntentHost */ @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response createIntent(InputStream stream) { try { IntentService service = get(IntentService.class); ObjectNode root = readTreeFromStream(mapper(), stream); Intent intent = codec(Intent.class).decode(root, this); service.submit(intent); UriBuilder locationBuilder = uriInfo.getBaseUriBuilder() .path("intents") .path(intent.appId().name()) .path(Long.toString(intent.id().fingerprint())); return Response .created(locationBuilder.build()) .build(); } catch (IOException ioe) { throw new IllegalArgumentException(ioe); } }
Example #12
Source File: IntentCleanupTestMock.java From onos with Apache License 2.0 | 6 votes |
@Before public void setUp() { service = createMock(IntentService.class); store = new SimpleIntentStore(); cleanup = new IntentCleanup(); cleanup.cfgService = new ComponentConfigAdapter(); cleanup.service = service; cleanup.store = store; cleanup.period = 1000; cleanup.retryThreshold = 3; assertTrue("store should be empty", Sets.newHashSet(cleanup.store.getIntents()).isEmpty()); super.setUp(); }
Example #13
Source File: IntentKeyCompleter.java From onos with Apache License 2.0 | 6 votes |
@Override public int complete(Session session, CommandLine commandLine, List<String> candidates) { // Delegate string completer StringsCompleter delegate = new StringsCompleter(); // Fetch our service and feed it's offerings to the string completer IntentService service = AbstractShellCommand.get(IntentService.class); Iterator<Intent> it = service.getIntents().iterator(); SortedSet<String> strings = delegate.getStrings(); while (it.hasNext()) { strings.add(it.next().key().toString()); } // Now let the completer do the work for figuring out what to offer. return delegate.complete(session, commandLine, candidates); }
Example #14
Source File: IntentsWebResource.java From onos with Apache License 2.0 | 6 votes |
/** * Gets intent installables by application ID and key. * @param appId application identifier * @param key intent key * * @return 200 OK with array of the intent installables * @onos.rsModel Intents */ @GET @Produces(MediaType.APPLICATION_JSON) @Path("installables/{appId}/{key}") public Response getIntentWithInstallable(@PathParam("appId") String appId, @PathParam("key") String key) { final IntentService intentService = get(IntentService.class); final ApplicationId app = get(CoreService.class).getAppId(appId); nullIsNotFound(app, APP_ID_NOT_FOUND); Intent intent = intentService.getIntent(Key.of(key, app)); if (intent == null) { long numericalKey = Long.decode(key); intent = intentService.getIntent(Key.of(numericalKey, app)); } nullIsNotFound(intent, INTENT_NOT_FOUND); final Iterable<Intent> installables = intentService.getInstallableIntents(intent.key()); final ObjectNode root = encodeArray(Intent.class, "installables", installables); return ok(root).build(); }
Example #15
Source File: AddProtectedTransportIntentCommand.java From onos with Apache License 2.0 | 6 votes |
@Override protected void doExecute() { intentService = get(IntentService.class); DeviceId did1 = DeviceId.deviceId(deviceId1Str); DeviceId did2 = DeviceId.deviceId(deviceId2Str); Intent intent; intent = ProtectedTransportIntent.builder() .key(key()) .appId(appId()) .one(did1) .two(did2) .build(); print("Submitting: %s", intent); intentService.submit(intent); }
Example #16
Source File: ApplicationNameImrCompleter.java From onos with Apache License 2.0 | 6 votes |
@Override public int complete(Session session, CommandLine commandLine, List<String> candidates) { // Delegate string completer StringsCompleter delegate = new StringsCompleter(); // Fetch our service and feed it's offerings to the string completer IntentService service = AbstractShellCommand.get(IntentService.class); SortedSet<String> strings = delegate.getStrings(); service.getIntents() .forEach(intent -> strings.add(intent.appId().name())); // Now let the completer do the work for figuring out what to offer. return delegate.complete(session, commandLine, candidates); }
Example #17
Source File: VirtualNetworkIntentCreateCommand.java From onos with Apache License 2.0 | 5 votes |
@Override protected void doExecute() { VirtualNetworkService service = get(VirtualNetworkService.class); IntentService virtualNetworkIntentService = service.get(NetworkId.networkId(networkId), IntentService.class); ConnectPoint ingress = ConnectPoint.deviceConnectPoint(ingressDeviceString); ConnectPoint egress = ConnectPoint.deviceConnectPoint(egressDeviceString); TrafficSelector selector = buildTrafficSelector(); TrafficTreatment treatment = buildTrafficTreatment(); List<Constraint> constraints = buildConstraints(); Intent intent = VirtualNetworkIntent.builder() .networkId(NetworkId.networkId(networkId)) .appId(appId()) .key(key()) .selector(selector) .treatment(treatment) .ingressPoint(ingress) .egressPoint(egress) .constraints(constraints) .priority(priority()) .build(); virtualNetworkIntentService.submit(intent); print("Virtual intent submitted:\n%s", intent.toString()); }
Example #18
Source File: IntentCodecTest.java From onos with Apache License 2.0 | 5 votes |
@Before public void setUpIntentService() { final IntentService mockIntentService = new IntentServiceAdapter(); context.registerService(IntentService.class, mockIntentService); context.registerService(CoreService.class, mockCoreService); expect(mockCoreService.getAppId(appId.name())) .andReturn(appId); replay(mockCoreService); }
Example #19
Source File: MultiPointToSinglePointIntentCodecTest.java From onos with Apache License 2.0 | 5 votes |
@Before public void setUpIntentService() { final IntentService mockIntentService = new IntentServiceAdapter(); context.registerService(IntentService.class, mockIntentService); context.registerService(CoreService.class, mockCoreService); expect(mockCoreService.getAppId(APPID.name())) .andReturn(APPID); replay(mockCoreService); }
Example #20
Source File: IntentCodec.java From onos with Apache License 2.0 | 5 votes |
@Override public ObjectNode encode(Intent intent, CodecContext context) { checkNotNull(intent, "Intent cannot be null"); final ObjectNode result = context.mapper().createObjectNode() .put(TYPE, intent.getClass().getSimpleName()) .put(ID, intent.id().toString()) .put(KEY, intent.key().toString()) .put(APP_ID, UrlEscapers.urlPathSegmentEscaper() .escape(intent.appId().name())); if (intent.resourceGroup() != null) { result.put(RESOURCE_GROUP, intent.resourceGroup().toString()); } final ArrayNode jsonResources = result.putArray(RESOURCES); intent.resources() .forEach(resource -> { if (resource instanceof Link) { jsonResources.add(context.codec(Link.class).encode((Link) resource, context)); } else { jsonResources.add(resource.toString()); } }); IntentService service = context.getService(IntentService.class); IntentState state = service.getIntentState(intent.key()); if (state != null) { result.put(STATE, state.toString()); } return result; }
Example #21
Source File: ObjectiveTracker.java From onos with Apache License 2.0 | 5 votes |
/** * Hook for wiring up optional reference to a service. * * @param service service being announced */ protected void bindComponentConfigService(IntentService service) { if (intentService == null) { intentService = service; scheduleIntentUpdate(1); } }
Example #22
Source File: IntentDetailsCommand.java From onos with Apache License 2.0 | 5 votes |
/** * Print detailed data for intents, given a list of IDs. * * @param intentsIds List of intent IDs */ public void detailIntents(List<String> intentsIds) { if (intentsIds != null) { ids = intentsIds.stream() .map(IntentId::valueOf) .collect(Collectors.toSet()); } IntentService service = get(IntentService.class); Tools.stream(service.getIntentData()) .filter(this::filter) .forEach(this::printIntentData); }
Example #23
Source File: VirtualNetworkManager.java From onos with Apache License 2.0 | 5 votes |
/** * Create a new vnet service instance. * * @param serviceKey service key * @return vnet service */ private VnetService create(ServiceKey serviceKey) { VirtualNetwork network = getVirtualNetwork(serviceKey.networkId()); checkNotNull(network, NETWORK_NULL); VnetService service; if (serviceKey.serviceClass.equals(DeviceService.class)) { service = new VirtualNetworkDeviceManager(this, network.id()); } else if (serviceKey.serviceClass.equals(LinkService.class)) { service = new VirtualNetworkLinkManager(this, network.id()); } else if (serviceKey.serviceClass.equals(TopologyService.class)) { service = new VirtualNetworkTopologyManager(this, network.id()); } else if (serviceKey.serviceClass.equals(IntentService.class)) { service = new VirtualNetworkIntentManager(this, network.id()); } else if (serviceKey.serviceClass.equals(HostService.class)) { service = new VirtualNetworkHostManager(this, network.id()); } else if (serviceKey.serviceClass.equals(PathService.class)) { service = new VirtualNetworkPathManager(this, network.id()); } else if (serviceKey.serviceClass.equals(FlowRuleService.class)) { service = new VirtualNetworkFlowRuleManager(this, network.id()); } else if (serviceKey.serviceClass.equals(PacketService.class)) { service = new VirtualNetworkPacketManager(this, network.id()); } else if (serviceKey.serviceClass.equals(GroupService.class)) { service = new VirtualNetworkGroupManager(this, network.id()); } else if (serviceKey.serviceClass.equals(MeterService.class)) { service = new VirtualNetworkMeterManager(this, network.id()); } else if (serviceKey.serviceClass.equals(FlowObjectiveService.class)) { service = new VirtualNetworkFlowObjectiveManager(this, network.id()); } else if (serviceKey.serviceClass.equals(MastershipService.class) || serviceKey.serviceClass.equals(MastershipAdminService.class) || serviceKey.serviceClass.equals(MastershipTermService.class)) { service = new VirtualNetworkMastershipManager(this, network.id()); } else { return null; } networkServices.put(serviceKey, service); return service; }
Example #24
Source File: VirtualNetworkManagerTest.java From onos with Apache License 2.0 | 5 votes |
/** * Tests that the get() method returns saved service instances. */ @Test public void testServiceGetReturnsSavedInstance() { manager.registerTenantId(TenantId.tenantId(tenantIdValue1)); VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1)); validateServiceGetReturnsSavedInstance(virtualNetwork.id(), DeviceService.class); validateServiceGetReturnsSavedInstance(virtualNetwork.id(), LinkService.class); validateServiceGetReturnsSavedInstance(virtualNetwork.id(), TopologyService.class); validateServiceGetReturnsSavedInstance(virtualNetwork.id(), HostService.class); validateServiceGetReturnsSavedInstance(virtualNetwork.id(), PathService.class); // extra setup needed for FlowRuleService, PacketService, GroupService, and IntentService VirtualProviderManager virtualProviderManager = new VirtualProviderManager(); virtualProviderManager.registerProvider(new DefaultVirtualFlowRuleProvider()); virtualProviderManager.registerProvider(new DefaultVirtualPacketProvider()); virtualProviderManager.registerProvider(new DefaultVirtualGroupProvider()); testDirectory.add(CoreService.class, coreService) .add(VirtualProviderRegistryService.class, virtualProviderManager) .add(EventDeliveryService.class, new TestEventDispatcher()) .add(ClusterService.class, new ClusterServiceAdapter()) .add(VirtualNetworkFlowRuleStore.class, new SimpleVirtualFlowRuleStore()) .add(VirtualNetworkPacketStore.class, new SimpleVirtualPacketStore()) .add(VirtualNetworkGroupStore.class, new SimpleVirtualGroupStore()) .add(VirtualNetworkIntentStore.class, new SimpleVirtualIntentStore()) .add(VirtualNetworkFlowObjectiveStore.class, new SimpleVirtualFlowObjectiveStore()); validateServiceGetReturnsSavedInstance(virtualNetwork.id(), FlowRuleService.class); validateServiceGetReturnsSavedInstance(virtualNetwork.id(), FlowObjectiveService.class); validateServiceGetReturnsSavedInstance(virtualNetwork.id(), PacketService.class); validateServiceGetReturnsSavedInstance(virtualNetwork.id(), GroupService.class); validateServiceGetReturnsSavedInstance(virtualNetwork.id(), IntentService.class); }
Example #25
Source File: RandomIntentCommand.java From onos with Apache License 2.0 | 5 votes |
@Override protected void doExecute() { service = get(IntentService.class); hostService = get(HostService.class); count = Integer.parseInt(countString); if (count > 0) { Collection<Intent> intents = generateIntents(); submitIntents(intents); } else { withdrawIntents(); } }
Example #26
Source File: AddPointToPointIntentCommand.java From onos with Apache License 2.0 | 5 votes |
@Override protected void doExecute() { IntentService service = get(IntentService.class); ConnectPoint ingress = ConnectPoint.deviceConnectPoint(ingressDeviceString); ConnectPoint egress = ConnectPoint.deviceConnectPoint(egressDeviceString); TrafficSelector selector = buildTrafficSelector(); TrafficTreatment treatment = buildTrafficTreatment(); List<Constraint> constraints = buildConstraints(); if (backup) { constraints.add(protection()); } if (useProtected) { constraints.add(ProtectedConstraint.useProtectedLink()); } Intent intent = PointToPointIntent.builder() .appId(appId()) .key(key()) .selector(selector) .treatment(treatment) .filteredIngressPoint(new FilteredConnectPoint(ingress)) .filteredEgressPoint(new FilteredConnectPoint(egress)) .constraints(constraints) .priority(priority()) .resourceGroup(resourceGroup()) .build(); service.submit(intent); print("Point to point intent submitted:\n%s", intent.toString()); }
Example #27
Source File: IntentPushTestCommand.java From onos with Apache License 2.0 | 5 votes |
@Override protected void doExecute() { service = get(IntentService.class); DeviceId ingressDeviceId = deviceId(getDeviceId(ingressDeviceString)); PortNumber ingressPortNumber = portNumber(getPortNumber(ingressDeviceString)); ConnectPoint ingress = new ConnectPoint(ingressDeviceId, ingressPortNumber); DeviceId egressDeviceId = deviceId(getDeviceId(egressDeviceString)); PortNumber egressPortNumber = portNumber(getPortNumber(egressDeviceString)); ConnectPoint egress = new ConnectPoint(egressDeviceId, egressPortNumber); count = Integer.parseInt(numberOfIntents); keyOffset = (keyOffsetStr != null) ? Integer.parseInt(keyOffsetStr) : 1; service.addListener(this); List<Intent> operations = generateIntents(ingress, egress); boolean both = !(installOnly ^ withdrawOnly); if (installOnly || both) { add = true; submitIntents(operations); } if (withdrawOnly || both) { add = false; submitIntents(operations); } service.removeListener(this); }
Example #28
Source File: AddMultiPointToSinglePointIntentCommand.java From onos with Apache License 2.0 | 5 votes |
@Override protected void doExecute() { IntentService service = get(IntentService.class); if (deviceStrings.length < 2) { return; } String egressDeviceString = deviceStrings[deviceStrings.length - 1]; FilteredConnectPoint egress = new FilteredConnectPoint(ConnectPoint.deviceConnectPoint(egressDeviceString)); Set<FilteredConnectPoint> ingressPoints = new HashSet<>(); for (int index = 0; index < deviceStrings.length - 1; index++) { String ingressDeviceString = deviceStrings[index]; ConnectPoint ingress = ConnectPoint.deviceConnectPoint(ingressDeviceString); ingressPoints.add(new FilteredConnectPoint(ingress)); } TrafficSelector selector = buildTrafficSelector(); TrafficTreatment treatment = buildTrafficTreatment(); List<Constraint> constraints = buildConstraints(); Intent intent = MultiPointToSinglePointIntent.builder() .appId(appId()) .key(key()) .selector(selector) .treatment(treatment) .filteredIngressPoints(ingressPoints) .filteredEgressPoint(egress) .constraints(constraints) .priority(priority()) .resourceGroup(resourceGroup()) .build(); service.submit(intent); print("Multipoint to single point intent submitted:\n%s", intent.toString()); }
Example #29
Source File: TestProtectionEndpointIntentCommand.java From onos with Apache License 2.0 | 5 votes |
@Override protected void doExecute() { fingerprint = Optional.ofNullable(fingerprint) .orElse(DEFAULT_FINGERPRINT); intentService = get(IntentService.class); deviceService = get(DeviceService.class); DeviceId did = DeviceId.deviceId(deviceIdStr); DeviceId peer = DeviceId.deviceId(peerStr); ProtectedTransportEndpointDescription description; List<TransportEndpointDescription> paths = new ArrayList<>(); paths.add(TransportEndpointDescription.builder() .withOutput(output(did, portNumber1Str, vlan1Str)) .build()); paths.add(TransportEndpointDescription.builder() .withOutput(output(did, portNumber2Str, vlan2Str)) .build()); description = ProtectedTransportEndpointDescription.of(paths, peer, fingerprint); ProtectionEndpointIntent intent; intent = ProtectionEndpointIntent.builder() .key(Key.of(fingerprint, appId())) .appId(appId()) .deviceId(did) .description(description) .build(); print("Submitting: %s", intent); intentService.submit(intent); }
Example #30
Source File: IntentsWebResource.java From onos with Apache License 2.0 | 5 votes |
/** * Gets all intents. * Returns array containing all the intents in the system. * * @return 200 OK with array of all the intents in the system * @onos.rsModel Intents */ @GET @Produces(MediaType.APPLICATION_JSON) public Response getIntents() { final Iterable<Intent> intents = get(IntentService.class).getIntents(); final ObjectNode root = encodeArray(Intent.class, "intents", intents); return ok(root).build(); }