Jonathan Hart

Remove old XOS-integration application

Change-Id: Ie4207f34714f75618fd3db52dd5c9474d91cb151
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
44 <module>bgprouter</module> 44 <module>bgprouter</module>
45 <module>test</module> 45 <module>test</module>
46 <module>segmentrouting</module> 46 <module>segmentrouting</module>
47 - <module>xos-integration</module>
48 <module>kafka-integration</module> 47 <module>kafka-integration</module>
49 <module>pcep-api</module> 48 <module>pcep-api</module>
50 <module>iptopology-api</module> 49 <module>iptopology-api</module>
......
1 -COMPILE_DEPS = [
2 - '//lib:CORE_DEPS',
3 - '//lib:jersey-client',
4 - '//lib:javax.ws.rs-api',
5 - '//lib:org.apache.karaf.shell.console',
6 - '//cli:onos-cli',
7 - '//utils/rest:onlab-rest',
8 -]
9 -
10 -osgi_jar_with_tests (
11 - deps = COMPILE_DEPS,
12 - import_packages = '*,org.onosproject.cli.net',
13 - resources_root = 'src/main/resources',
14 - resources = glob(['src/main/resources/**']),
15 -)
16 -
17 -onos_app (
18 - title = 'ONOS XOS Integration App',
19 - category = 'Utility',
20 - url = 'http://onosproject.org',
21 - description = 'ONOS XOS integration application.',
22 -)
1 -<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2 -<!--
3 - ~ Copyright 2015-present Open Networking Laboratory
4 - ~
5 - ~ Licensed under the Apache License, Version 2.0 (the "License");
6 - ~ you may not use this file except in compliance with the License.
7 - ~ You may obtain a copy of the License at
8 - ~
9 - ~ http://www.apache.org/licenses/LICENSE-2.0
10 - ~
11 - ~ Unless required by applicable law or agreed to in writing, software
12 - ~ distributed under the License is distributed on an "AS IS" BASIS,
13 - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 - ~ See the License for the specific language governing permissions and
15 - ~ limitations under the License.
16 - -->
17 -<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
18 - <feature name="${project.artifactId}" version="${project.version}"
19 - description="${project.description}">
20 - <bundle>mvn:org.glassfish.jersey.core/jersey-client/2.22.2</bundle>
21 - <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
22 - </feature>
23 -</features>
1 -<?xml version="1.0" encoding="UTF-8"?>
2 -<!--
3 - ~ Copyright 2015-present Open Networking Laboratory
4 - ~
5 - ~ Licensed under the Apache License, Version 2.0 (the "License");
6 - ~ you may not use this file except in compliance with the License.
7 - ~ You may obtain a copy of the License at
8 - ~
9 - ~ http://www.apache.org/licenses/LICENSE-2.0
10 - ~
11 - ~ Unless required by applicable law or agreed to in writing, software
12 - ~ distributed under the License is distributed on an "AS IS" BASIS,
13 - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 - ~ See the License for the specific language governing permissions and
15 - ~ limitations under the License.
16 - -->
17 -<project xmlns="http://maven.apache.org/POM/4.0.0"
18 - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19 - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
20 - <modelVersion>4.0.0</modelVersion>
21 -
22 - <parent>
23 - <groupId>org.onosproject</groupId>
24 - <artifactId>onos-apps</artifactId>
25 - <version>1.7.0-SNAPSHOT</version>
26 - </parent>
27 -
28 - <artifactId>onos-app-xos-integration</artifactId>
29 - <packaging>bundle</packaging>
30 -
31 - <description>ONOS XOS integration application</description>
32 -
33 - <properties>
34 - <onos.app.name>org.onosproject.xosintegration</onos.app.name>
35 - <onos.app.title>ONOS XOS Integration App</onos.app.title>
36 - <onos.app.category>Utility</onos.app.category>
37 - <onos.app.url>http://onosproject.org</onos.app.url>
38 - <onos.app.readme>ONOS XOS integration application.</onos.app.readme>
39 - </properties>
40 -
41 - <dependencies>
42 - <dependency>
43 - <groupId>org.osgi</groupId>
44 - <artifactId>org.osgi.compendium</artifactId>
45 - </dependency>
46 - <dependency>
47 - <groupId>org.glassfish.jersey.core</groupId>
48 - <artifactId>jersey-client</artifactId>
49 - <version>2.22.2</version>
50 - </dependency>
51 - <dependency>
52 - <groupId>org.onosproject</groupId>
53 - <artifactId>onos-cli</artifactId>
54 - <version>${project.version}</version>
55 - </dependency>
56 - <dependency>
57 - <groupId>org.osgi</groupId>
58 - <artifactId>org.osgi.core</artifactId>
59 - </dependency>
60 - <dependency>
61 - <groupId>org.apache.karaf.shell</groupId>
62 - <artifactId>org.apache.karaf.shell.console</artifactId>
63 - </dependency>
64 - <dependency>
65 - <groupId>org.onosproject</groupId>
66 - <artifactId>onlab-misc</artifactId>
67 - </dependency>
68 - </dependencies>
69 -
70 -</project>
1 -/*
2 - * Copyright 2015-present Open Networking Laboratory
3 - *
4 - * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with the License.
6 - * You may obtain a copy of the License at
7 - *
8 - * http://www.apache.org/licenses/LICENSE-2.0
9 - *
10 - * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and
14 - * limitations under the License.
15 - */
16 -package org.onosproject.xosintegration;
17 -
18 -import com.google.common.base.MoreObjects;
19 -import org.onosproject.net.ConnectPoint;
20 -
21 -public final class VoltTenant {
22 -
23 - private final String humanReadableName;
24 - private final long id;
25 - private final long providerService;
26 - private final String serviceSpecificId;
27 - private final String vlanId;
28 - private final ConnectPoint port;
29 -
30 - /**
31 - * Constructs a vOLT tenant object.
32 - *
33 - * @param humanReadableName name string
34 - * @param id identifier for the tenant
35 - * @param providerService provider service ID
36 - * @param serviceSpecificId id for the user
37 - * @param vlanId vlan id for the user
38 - */
39 - private VoltTenant(String humanReadableName, long id, long providerService,
40 - String serviceSpecificId, String vlanId, ConnectPoint port) {
41 - this.humanReadableName = humanReadableName;
42 - this.id = id;
43 - this.providerService = providerService;
44 - this.serviceSpecificId = serviceSpecificId;
45 - this.vlanId = vlanId;
46 - this.port = port;
47 - }
48 -
49 - /**
50 - * Fetches a builder to make a tenant.
51 - *
52 - * @return tenant builder
53 - */
54 - public static Builder builder() {
55 - return new Builder();
56 - }
57 -
58 - /**
59 - * Fetches the name of the tenant.
60 - *
61 - * @return human readable name
62 - */
63 - public String humanReadableName() {
64 - return humanReadableName;
65 - }
66 -
67 - /**
68 - * Fetches the ID of the tenant object.
69 - *
70 - * @return ID of tenant object.
71 - */
72 - public long id() {
73 - return id;
74 - }
75 -
76 - /**
77 - * Fetches the identifier for the provider service.
78 - *
79 - * @return provider service ID
80 - */
81 - public long providerService() {
82 - return providerService;
83 - }
84 -
85 - /**
86 - * Fetches the server specific ID (user id).
87 - *
88 - * @return server specific ID
89 - */
90 - public String serviceSpecificId() {
91 - return serviceSpecificId;
92 - }
93 -
94 - /**
95 - * Fetches the vlan id for this tenant.
96 - *
97 - * @return VLAN ID
98 - */
99 - public String vlanId() {
100 - return vlanId;
101 - }
102 -
103 - public ConnectPoint port() {
104 - return port;
105 - }
106 -
107 - /**
108 - * Builder class to allow callers to assemble tenants.
109 - */
110 -
111 - public static final class Builder {
112 - private String humanReadableName = "unknown";
113 - private long id = 0;
114 - private long providerService = -1;
115 - private String serviceSpecificId = "unknown";
116 - private String vlanId = "unknown";
117 - private ConnectPoint port;
118 -
119 - /**
120 - * Sets the name string for the tenant.
121 - *
122 - * @param humanReadableName name
123 - * @return self
124 - */
125 - public Builder withHumanReadableName(String humanReadableName) {
126 - this.humanReadableName = humanReadableName;
127 - return this;
128 - }
129 -
130 - /**
131 - * Sets the identifier for the tenant.
132 - *
133 - * @param id identifier for the tenant
134 - * @return self
135 - */
136 - public Builder withId(long id) {
137 - this.id = id;
138 - return this;
139 - }
140 -
141 - /**
142 - * Sets the server specific id (user id) for the tenant.
143 - *
144 - * @param serviceSpecificId server specific (user) id
145 - * @return self
146 - */
147 - public Builder withServiceSpecificId(String serviceSpecificId) {
148 - this.serviceSpecificId = serviceSpecificId;
149 - return this;
150 - }
151 -
152 - /**
153 - * Sets the VLAN ID for the tenant.
154 - *
155 - * @param vlanId VLAN ID
156 - * @return self
157 - */
158 - public Builder withVlanId(String vlanId) {
159 - this.vlanId = vlanId;
160 - return this;
161 - }
162 -
163 - /**
164 - * Sets the provider service ID.
165 - *
166 - * @param providerService provider service ID
167 - * @return self
168 - */
169 - public Builder withProviderService(long providerService) {
170 - this.providerService = providerService;
171 - return this;
172 - }
173 -
174 - public Builder withPort(ConnectPoint port) {
175 - this.port = port;
176 - return this;
177 - }
178 -
179 - /**
180 - * Constructs a VoltTenant from the assembled data.
181 - *
182 - * @return constructed tenant object
183 - */
184 - public VoltTenant build() {
185 - return new VoltTenant(humanReadableName, id, providerService,
186 - serviceSpecificId, vlanId, port);
187 - }
188 - }
189 -
190 - @Override
191 - public String toString() {
192 - return MoreObjects.toStringHelper(getClass())
193 - .add("humanReadableName", humanReadableName())
194 - .add("id", id())
195 - .add("providerService", providerService())
196 - .add("serviceSpecificId", serviceSpecificId())
197 - .add("vlanId", vlanId())
198 - .add("port", port())
199 - .toString();
200 - }
201 -
202 -}
1 -/*
2 - * Copyright 2015-present Open Networking Laboratory
3 - *
4 - * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with the License.
6 - * You may obtain a copy of the License at
7 - *
8 - * http://www.apache.org/licenses/LICENSE-2.0
9 - *
10 - * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and
14 - * limitations under the License.
15 - */
16 -package org.onosproject.xosintegration;
17 -
18 -import java.util.Set;
19 -
20 -public interface VoltTenantService {
21 -
22 - /**
23 - * Queries all the tenants.
24 - *
25 - * @return Set of all of the tenants
26 - */
27 - Set<VoltTenant> getAllTenants();
28 -
29 - /**
30 - * Removes a tenant given its ID.
31 - *
32 - * @param id if od tenant to remove.
33 - */
34 - void removeTenant(long id);
35 -
36 - /**
37 - * Creates a new tenant and adds it to the XOS instance.
38 - *
39 - * @param newTenant tenant to add
40 - * @return the added tenant
41 - */
42 - VoltTenant addTenant(VoltTenant newTenant);
43 -
44 - /**
45 - * Gets a single tenant for the given ID.
46 - *
47 - * @param id ID of the tenant to fetch
48 - * @return tenant that was fetched
49 - */
50 - VoltTenant getTenant(long id);
51 -}
1 -/*
2 - * Copyright 2015-present Open Networking Laboratory
3 - *
4 - * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with the License.
6 - * You may obtain a copy of the License at
7 - *
8 - * http://www.apache.org/licenses/LICENSE-2.0
9 - *
10 - * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and
14 - * limitations under the License.
15 - */
16 -package org.onosproject.xosintegration.cli;
17 -
18 -import java.util.List;
19 -
20 -import org.onosproject.cli.AbstractChoicesCompleter;
21 -import org.onosproject.xosintegration.VoltTenant;
22 -import org.onosproject.xosintegration.VoltTenantService;
23 -import static java.util.stream.Collectors.toList;
24 -
25 -import static org.onosproject.cli.AbstractShellCommand.get;
26 -
27 -
28 -/**
29 - * Application command completer.
30 - */
31 -public class TenantIdCompleter extends AbstractChoicesCompleter {
32 - @Override
33 - public List<String> choices() {
34 - VoltTenantService service = get(VoltTenantService.class);
35 -
36 - return service.getAllTenants().stream()
37 - .map(VoltTenant::id)
38 - .map(Object::toString)
39 - .collect(toList());
40 -
41 - }
42 -
43 -}
1 -/*
2 - * Copyright 2015-present Open Networking Laboratory
3 - *
4 - * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with the License.
6 - * You may obtain a copy of the License at
7 - *
8 - * http://www.apache.org/licenses/LICENSE-2.0
9 - *
10 - * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and
14 - * limitations under the License.
15 - */
16 -package org.onosproject.xosintegration.cli;
17 -
18 -import org.apache.karaf.shell.commands.Argument;
19 -import org.apache.karaf.shell.commands.Command;
20 -import org.onosproject.cli.AbstractShellCommand;
21 -import org.onosproject.xosintegration.VoltTenantService;
22 -
23 -/**
24 - * CLI command to remove an existing tenant from the system.
25 - */
26 -@Command(scope = "onos", name = "remove-tenant",
27 - description = "Removes a tenant")
28 -public class VoltRemoveTenantCommand extends AbstractShellCommand {
29 -
30 - @Argument(index = 0, name = "tenant",
31 - description = "Tenant ID",
32 - required = true, multiValued = false)
33 - String tenantIdString = null;
34 -
35 - @Override
36 - protected void execute() {
37 - VoltTenantService service = get(VoltTenantService.class);
38 -
39 - service.removeTenant(Long.parseLong(tenantIdString));
40 - }
41 -}
1 -/*
2 - * Copyright 2015-present Open Networking Laboratory
3 - *
4 - * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with the License.
6 - * You may obtain a copy of the License at
7 - *
8 - * http://www.apache.org/licenses/LICENSE-2.0
9 - *
10 - * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and
14 - * limitations under the License.
15 - */
16 -package org.onosproject.xosintegration.cli;
17 -
18 -import org.apache.karaf.shell.commands.Argument;
19 -import org.apache.karaf.shell.commands.Command;
20 -import org.onosproject.cli.AbstractShellCommand;
21 -import org.onosproject.net.ConnectPoint;
22 -import org.onosproject.xosintegration.VoltTenant;
23 -import org.onosproject.xosintegration.VoltTenantService;
24 -
25 -/**
26 - * CLI command to create a new tenant.
27 - */
28 -@Command(scope = "onos", name = "add-tenant",
29 - description = "Lists the inventory of VOLT tenants and their contents")
30 -public class VoltTenantsCreateCommand extends AbstractShellCommand {
31 -
32 - @Argument(index = 0, name = "service specific ID",
33 - description = "service specific ID",
34 - required = true, multiValued = false)
35 - String serviceSpecificId;
36 -
37 - @Argument(index = 1, name = "vlan ID",
38 - description = "vlan ID",
39 - required = true, multiValued = false)
40 - String vlanId;
41 -
42 - @Argument(index = 2, name = "port",
43 - description = "Port",
44 - required = true, multiValued = false)
45 - String port;
46 -
47 - @Override
48 - protected void execute() {
49 - VoltTenantService service = get(VoltTenantService.class);
50 -
51 - VoltTenant newTenant = VoltTenant.builder()
52 - .withServiceSpecificId(serviceSpecificId)
53 - .withVlanId(vlanId)
54 - .withPort(ConnectPoint.deviceConnectPoint(port))
55 - .build();
56 -
57 - service.addTenant(newTenant);
58 - }
59 -}
1 -/*
2 - * Copyright 2015-present Open Networking Laboratory
3 - *
4 - * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with the License.
6 - * You may obtain a copy of the License at
7 - *
8 - * http://www.apache.org/licenses/LICENSE-2.0
9 - *
10 - * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and
14 - * limitations under the License.
15 - */
16 -package org.onosproject.xosintegration.cli;
17 -
18 -import java.util.Set;
19 -
20 -import org.apache.karaf.shell.commands.Argument;
21 -import org.apache.karaf.shell.commands.Command;
22 -import org.onosproject.cli.AbstractShellCommand;
23 -import org.onosproject.xosintegration.VoltTenant;
24 -import org.onosproject.xosintegration.VoltTenantService;
25 -
26 -/**
27 - * CLI command for listing VOLT tenant objects.
28 - */
29 -
30 -/**
31 - * CLI command to list the existing tenants.
32 - */
33 -@Command(scope = "onos", name = "tenants",
34 - description = "Lists the inventory of VOLT tenants and their contents")
35 -public class VoltTenantsListCommand extends AbstractShellCommand {
36 -
37 - @Argument(index = 0, name = "tenantId",
38 - description = "Tenant ID",
39 - required = false, multiValued = false)
40 - private String tenantId = null;
41 -
42 - @Override
43 - protected void execute() {
44 - VoltTenantService service = get(VoltTenantService.class);
45 -
46 - if (tenantId != null) {
47 - VoltTenant tenant = service.getTenant(Long.parseLong(tenantId));
48 - if (tenant != null) {
49 - print(tenant.toString());
50 - } else {
51 - error("Tenant not found {}", tenantId);
52 - }
53 - } else {
54 - Set<VoltTenant> tenants = service.getAllTenants();
55 - for (VoltTenant tenant : tenants) {
56 - print(tenant.toString());
57 - }
58 - }
59 - }
60 -
61 -}
1 -/*
2 - * Copyright 2015-present Open Networking Laboratory
3 - *
4 - * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with the License.
6 - * You may obtain a copy of the License at
7 - *
8 - * http://www.apache.org/licenses/LICENSE-2.0
9 - *
10 - * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and
14 - * limitations under the License.
15 - */
16 -
17 -/**
18 - * XOS integration application CLI commands.
19 - */
20 -package org.onosproject.xosintegration.cli;
...\ No newline at end of file ...\ No newline at end of file
1 -/*
2 - * Copyright 2015-present Open Networking Laboratory
3 - *
4 - * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with the License.
6 - * You may obtain a copy of the License at
7 - *
8 - * http://www.apache.org/licenses/LICENSE-2.0
9 - *
10 - * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and
14 - * limitations under the License.
15 - */
16 -
17 -/**
18 - * XOS integration application which relies on XOS REST APIs to manage VMs.
19 - */
20 -package org.onosproject.xosintegration;
1 -<!--
2 - ~ Copyright 2015-present Open Networking Laboratory
3 - ~
4 - ~ Licensed under the Apache License, Version 2.0 (the "License");
5 - ~ you may not use this file except in compliance with the License.
6 - ~ You may obtain a copy of the License at
7 - ~
8 - ~ http://www.apache.org/licenses/LICENSE-2.0
9 - ~
10 - ~ Unless required by applicable law or agreed to in writing, software
11 - ~ distributed under the License is distributed on an "AS IS" BASIS,
12 - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - ~ See the License for the specific language governing permissions and
14 - ~ limitations under the License.
15 - -->
16 -<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
17 - <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
18 - <command>
19 - <action class="org.onosproject.xosintegration.cli.VoltTenantsListCommand"/>
20 - <completers>
21 - <ref component-id="tenantIdCompleter"/>
22 - <null/>
23 - </completers>
24 - </command>
25 - <command>
26 - <action class="org.onosproject.xosintegration.cli.VoltTenantsCreateCommand"/>
27 - <completers>
28 - <ref component-id="placeholderCompleter"/>
29 - <ref component-id="placeholderCompleter"/>
30 - <ref component-id="connectPointCompleter"/>
31 - <null/>
32 - </completers>
33 - </command>
34 - <command>
35 - <action class="org.onosproject.xosintegration.cli.VoltRemoveTenantCommand"/>
36 - <completers>
37 - <ref component-id="tenantIdCompleter"/>
38 - <null/>
39 - </completers>
40 - </command>
41 - </command-bundle>
42 - <bean id="tenantIdCompleter" class="org.onosproject.xosintegration.cli.TenantIdCompleter"/>
43 - <bean id="placeholderCompleter" class="org.onosproject.cli.PlaceholderCompleter"/>
44 - <bean id="connectPointCompleter" class="org.onosproject.cli.net.ConnectPointCompleter"/>
45 -</blueprint>