Thomas Vachuska

Initial sketch of the virtual network constructs.

Change-Id: Ibcdafb9e56edb29fb37b80d7b0da321ad989c564
...@@ -26,7 +26,7 @@ public interface Device extends Element { ...@@ -26,7 +26,7 @@ public interface Device extends Element {
26 * Coarse classification of the type of the infrastructure device. 26 * Coarse classification of the type of the infrastructure device.
27 */ 27 */
28 public enum Type { 28 public enum Type {
29 - SWITCH, ROUTER, ROADM, OTN, ROADM_OTN, FIREWALL, BALANCER, IPS, IDS, CONTROLLER, OTHER 29 + SWITCH, ROUTER, ROADM, OTN, ROADM_OTN, FIREWALL, BALANCER, IPS, IDS, CONTROLLER, VIRTUAL, OTHER
30 } 30 }
31 31
32 /** 32 /**
...@@ -79,10 +79,4 @@ public interface Device extends Element { ...@@ -79,10 +79,4 @@ public interface Device extends Element {
79 */ 79 */
80 ChassisId chassisId(); 80 ChassisId chassisId();
81 81
82 - // Device realizedBy(); ?
83 -
84 - // ports are not provided directly, but rather via DeviceService.getPorts(Device device);
85 -
86 - // Set<Behavior> behaviours(); // set of supported behaviours
87 -
88 } 82 }
......
...@@ -51,7 +51,12 @@ public interface Link extends Annotated, Provided, NetworkResource { ...@@ -51,7 +51,12 @@ public interface Link extends Annotated, Provided, NetworkResource {
51 /** 51 /**
52 * Signifies that this link is realized by fiber (either single channel or WDM). 52 * Signifies that this link is realized by fiber (either single channel or WDM).
53 */ 53 */
54 - OPTICAL 54 + OPTICAL,
55 +
56 + /**
57 + * Signifies that this link is a virtual link or a pseudo-wire.
58 + */
59 + VIRTUAL
55 } 60 }
56 61
57 /** 62 /**
......
...@@ -53,7 +53,12 @@ public interface Port extends Annotated { ...@@ -53,7 +53,12 @@ public interface Port extends Annotated {
53 * Signifies optical fiber-based WDM port (called W-port). 53 * Signifies optical fiber-based WDM port (called W-port).
54 * Optical Multiplexing Section (See ITU G.709). 54 * Optical Multiplexing Section (See ITU G.709).
55 */ 55 */
56 - OMS 56 + OMS,
57 +
58 + /**
59 + * Signifies virtual port.
60 + */
61 + VIRTUAL
57 } 62 }
58 63
59 /** 64 /**
......
...@@ -17,11 +17,12 @@ package org.onosproject.net.behaviour; ...@@ -17,11 +17,12 @@ package org.onosproject.net.behaviour;
17 17
18 import com.google.common.primitives.UnsignedInteger; 18 import com.google.common.primitives.UnsignedInteger;
19 import org.onosproject.net.device.PortDescription; 19 import org.onosproject.net.device.PortDescription;
20 +import org.onosproject.net.driver.HandlerBehaviour;
20 21
21 /** 22 /**
22 * Means to configure a logical port at the device. 23 * Means to configure a logical port at the device.
23 */ 24 */
24 -public interface PortConfig { 25 +public interface PortConfig extends HandlerBehaviour {
25 26
26 /** 27 /**
27 * Apply QoS configuration on a device. 28 * Apply QoS configuration on a device.
......
1 +/*
2 + * Copyright 2015 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.incubator.net.virtual;
17 +
18 +import com.google.common.annotations.Beta;
19 +
20 +import java.util.Objects;
21 +
22 +/**
23 + * Representation of network identity.
24 + */
25 +@Beta
26 +public final class NetworkId {
27 +
28 + /**
29 + * Represents no network, or an unspecified network.
30 + */
31 + public static final NetworkId NONE = networkId(-1L);
32 +
33 + /**
34 + * Represents the underlying physical network.
35 + */
36 + public static final NetworkId PHYSICAL = networkId(0L);
37 +
38 +
39 + private final long id;
40 +
41 + // Public construction is prohibited
42 + private NetworkId(long id) {
43 + this.id = id;
44 + }
45 +
46 +
47 + // Default constructor for serialization
48 + protected NetworkId() {
49 + this.id = -1;
50 + }
51 +
52 + /**
53 + * Creates a network id using the supplied backing id.
54 + *
55 + * @param id network id
56 + * @return network identifier
57 + */
58 + public static NetworkId networkId(long id) {
59 + return new NetworkId(id);
60 + }
61 +
62 + @Override
63 + public int hashCode() {
64 + return Objects.hash(id);
65 + }
66 +
67 + @Override
68 + public boolean equals(Object obj) {
69 + if (this == obj) {
70 + return true;
71 + }
72 + if (obj instanceof NetworkId) {
73 + final NetworkId that = (NetworkId) obj;
74 + return this.getClass() == that.getClass() && this.id == that.id;
75 + }
76 + return false;
77 + }
78 +
79 + @Override
80 + public String toString() {
81 + return Long.toString(id);
82 + }
83 +
84 +}
1 +/*
2 + * Copyright 2015 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.incubator.net.virtual;
17 +
18 +import com.google.common.annotations.Beta;
19 +
20 +import java.util.Objects;
21 +
22 +import static com.google.common.base.Preconditions.checkArgument;
23 +
24 +/**
25 + * Representation of network tenant.
26 + */
27 +@Beta
28 +public final class TenantId {
29 +
30 + /**
31 + * Represents no tenant, or an unspecified tenant.
32 + */
33 + public static final TenantId NONE = new TenantId();
34 +
35 +
36 + private final String id;
37 +
38 + // Public construction is prohibited
39 + private TenantId(String id) {
40 + checkArgument(id != null && id.length() > 0, "Tenant ID cannot be null or empty");
41 + this.id = id;
42 + }
43 +
44 +
45 + // Default constructor for serialization
46 + protected TenantId() {
47 + this.id = "";
48 + }
49 +
50 + /**
51 + * Creates a tenant id using the supplied backing id.
52 + *
53 + * @param id network id
54 + * @return network identifier
55 + */
56 + public static TenantId tenantId(String id) {
57 + return new TenantId(id);
58 + }
59 +
60 + @Override
61 + public int hashCode() {
62 + return Objects.hash(id);
63 + }
64 +
65 + @Override
66 + public boolean equals(Object obj) {
67 + if (this == obj) {
68 + return true;
69 + }
70 + if (obj instanceof TenantId) {
71 + final TenantId that = (TenantId) obj;
72 + return this.getClass() == that.getClass() &&
73 + Objects.equals(this.id, that.id);
74 + }
75 + return false;
76 + }
77 +
78 + @Override
79 + public String toString() {
80 + return id;
81 + }
82 +
83 +}
1 +/*
2 + * Copyright 2015 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.incubator.net.virtual;
17 +
18 +import com.google.common.annotations.Beta;
19 +import org.onosproject.net.Device;
20 +
21 +/**
22 + * Abstraction of a virtual device.
23 + */
24 +@Beta
25 +public interface VirtualDevice extends VirtualElement, Device {
26 +}
1 +/*
2 + * Copyright 2015 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.incubator.net.virtual;
17 +
18 +import com.google.common.annotations.Beta;
19 +
20 +/**
21 + * Abstraction of a virtual element.
22 + */
23 +@Beta
24 +public interface VirtualElement {
25 +
26 + /**
27 + * Returns the identifier of the tenant to which this virtual element belongs.
28 + *
29 + * @return tenant identifier
30 + */
31 + TenantId tenantId();
32 +
33 + /**
34 + * Returns the network identifier to which this virtual element belongs.
35 + *
36 + * @return network identifier
37 + */
38 + NetworkId networkId();
39 +}
1 +/*
2 + * Copyright 2015 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.incubator.net.virtual;
17 +
18 +import com.google.common.annotations.Beta;
19 +import org.onosproject.net.Host;
20 +
21 +/**
22 + * Abstraction of a virtual end-station host.
23 + */
24 +@Beta
25 +public interface VirtualHost extends VirtualElement, Host {
26 +}
1 +/*
2 + * Copyright 2015 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.incubator.net.virtual;
17 +
18 +import com.google.common.annotations.Beta;
19 +import org.onosproject.net.Link;
20 +
21 +/**
22 + * Abstraction of a virtual link.
23 + */
24 +@Beta
25 +public interface VirtualLink extends VirtualElement, Link {
26 +}
1 +/*
2 + * Copyright 2015 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.incubator.net.virtual;
17 +
18 +import com.google.common.annotations.Beta;
19 +
20 +/**
21 + * Representation of a virtual network.
22 + */
23 +@Beta
24 +public interface VirtualNetwork {
25 +
26 + /**
27 + * Returns the network identifier.
28 + *
29 + * @return network id
30 + */
31 + NetworkId id();
32 +
33 + /**
34 + * Returns the identifier of the tenant to which this virtual network belongs.
35 + *
36 + * @return tenant identifier
37 + */
38 + TenantId tenantId();
39 +
40 +}
1 +/*
2 + * Copyright 2015 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.incubator.net.virtual;
17 +
18 +import com.google.common.annotations.Beta;
19 +import org.onosproject.incubator.net.tunnel.Tunnel;
20 +import org.onosproject.net.ConnectPoint;
21 +import org.onosproject.net.DeviceId;
22 +import org.onosproject.net.Port;
23 +import org.onosproject.net.PortNumber;
24 +import org.onosproject.net.device.DeviceDescription;
25 +import org.onosproject.net.device.PortDescription;
26 +import org.onosproject.net.link.LinkDescription;
27 +
28 +import java.util.Set;
29 +
30 +/**
31 + * Service for managing the inventory of virtual networks.
32 + */
33 +@Beta
34 +public interface VirtualNetworkAdminService extends VirtualNetworkService {
35 +
36 + /**
37 + * Registers the specified, externally generated tenant identifier.
38 + *
39 + * @param tenantId tenant identifier
40 + */
41 + void registerTenantId(TenantId tenantId);
42 +
43 + /**
44 + * Unregisters the specified, externally generated tenant identifier.
45 + *
46 + * @param tenantId tenant identifier
47 + * @throws IllegalStateException if there are networks still owned by this tenant
48 + */
49 + void unregisterTenantId(TenantId tenantId);
50 +
51 + /**
52 + * Returns the set of tenant identifiers known to the system.
53 + *
54 + * @return set of known tenant identifiers
55 + */
56 + Set<TenantId> getTenantIds();
57 +
58 +
59 + /**
60 + * Creates a new virtual network for the specified tenant.
61 + *
62 + * @param tenantId tenant identifier
63 + * @return newly created virtual network
64 + */
65 + VirtualNetwork createVirtualNetwork(TenantId tenantId);
66 +
67 + /**
68 + * Removes the specified virtual network and all its devices and links.
69 + *
70 + * @param networkId network identifier
71 + */
72 + void removeVirtualNetwork(NetworkId networkId);
73 +
74 +
75 + /**
76 + * Creates a new virtual device within the specified network. The device id
77 + * must be unique within the bounds of the network.
78 + *
79 + * @param networkId network identifier
80 + * @param description device description
81 + * @return newly created device
82 + * @throws org.onlab.util.ItemNotFoundException if no such network found
83 + */
84 + VirtualDevice createVirtualDevice(NetworkId networkId, DeviceDescription description);
85 +
86 + /**
87 + * Removes the specified virtual device and all its ports and affiliated links.
88 + *
89 + * @param networkId network identifier
90 + * @param deviceId device identifier
91 + * @throws org.onlab.util.ItemNotFoundException if no such network or device found
92 + */
93 + void removeVirtualDevice(NetworkId networkId, DeviceId deviceId);
94 +
95 +
96 + /**
97 + * Creates a new virtual link within the specified network.
98 + *
99 + * @param networkId network identifier
100 + * @param description link description
101 + * @param realizedBy tunnel using which this link is realized
102 + * @return newly created virtual link
103 + * @throws org.onlab.util.ItemNotFoundException if no such network found
104 + */
105 + VirtualLink createVirtualLink(NetworkId networkId, LinkDescription description,
106 + Tunnel realizedBy);
107 +
108 + // TODO: Discuss whether we should provide an alternate createVirtualLink
109 + // which is backed by a Path instead; I'm leaning towards not doing that.
110 +
111 + /**
112 + * Removes the specified virtual link.
113 + *
114 + * @param networkId network identifier
115 + * @param src source connection point
116 + * @param dst destination connection point
117 + * @throws org.onlab.util.ItemNotFoundException if no such network or link found
118 + */
119 + void removeVirtualLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst);
120 +
121 + /**
122 + * Creates a new virtual port on the specified device. Note that the port
123 + * description can only request the resources which the underlying port
124 + * port is capable of providing. It is, however, permissible to request
125 + * only portion of those resources.
126 + *
127 + * @param networkId network identifier
128 + * @param deviceId device identifier
129 + * @param description port description
130 + * @param realizedBy underlying port using which this virtual port is realized
131 + * @return newly created port
132 + * @throws org.onlab.util.ItemNotFoundException if no such network or device found
133 + */
134 + VirtualPort createVirtualPort(NetworkId networkId, DeviceId deviceId,
135 + PortDescription description, Port realizedBy);
136 +
137 + /**
138 + * Removes the specified virtual port.
139 + *
140 + * @param networkId network identifier
141 + * @param deviceId device identifier
142 + * @param portNumber port number
143 + * @throws org.onlab.util.ItemNotFoundException if no such network or port found
144 + */
145 + void removeVirtualPort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber);
146 +
147 +}
1 +/*
2 + * Copyright 2015 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.incubator.net.virtual;
17 +
18 +import com.google.common.annotations.Beta;
19 +import org.onosproject.net.DeviceId;
20 +
21 +import java.util.Set;
22 +
23 +/**
24 + * Service for querying virtual network inventory.
25 + */
26 +@Beta
27 +public interface VirtualNetworkService {
28 +
29 + /**
30 + * Returns a collection of all virtual networks created on behalf of the
31 + * specified tenant.
32 + *
33 + * @param tenantId tenant identifier
34 + * @return collection of networks
35 + * @throws org.onlab.util.ItemNotFoundException if no such network found
36 + */
37 + Set<VirtualNetwork> getVirtualNetworks(TenantId tenantId);
38 +
39 + /**
40 + * Returns a collection of all virtual devices in the specified network.
41 + *
42 + * @param networkId network identifier
43 + * @return collection of devices
44 + * @throws org.onlab.util.ItemNotFoundException if no such network found
45 + */
46 + Set<VirtualDevice> getVirtualDevices(NetworkId networkId);
47 +
48 + /**
49 + * Returns collection of all virtual links in the specified network.
50 + *
51 + * @param networkId network identifier
52 + * @return collection of links
53 + * @throws org.onlab.util.ItemNotFoundException if no such network found
54 + */
55 + Set<VirtualLink> getVirtualLinks(NetworkId networkId);
56 +
57 + /**
58 + * Returns list of all virtual ports of the specified device.
59 + *
60 + * @param networkId network identifier
61 + * @param deviceId device identifier
62 + * @return list of ports
63 + * @throws org.onlab.util.ItemNotFoundException if no such network found
64 + */
65 + Set<VirtualPort> getVirtualPorts(NetworkId networkId, DeviceId deviceId);
66 +
67 + /**
68 + * Returns implementation of the specified service class for operating
69 + * in the context of the given network.
70 + * <p>
71 + * The following services will be available:
72 + * <ul>
73 + * <li>{@link org.onosproject.net.device.DeviceService}</li>
74 + * <li>{@link org.onosproject.net.link.LinkService}</li>
75 + * <li>{@link org.onosproject.net.host.HostService}</li>
76 + * <li>{@link org.onosproject.net.topology.TopologyService}</li>
77 + * <li>{@link org.onosproject.net.topology.PathService}</li>
78 + * <li>{@link org.onosproject.net.flow.FlowRuleService}</li>
79 + * <li>{@link org.onosproject.net.flowobjective.FlowObjectiveService}</li>
80 + * <li>{@link org.onosproject.net.intent.IntentService}</li>
81 + * </ul>
82 + *
83 + * @param networkId network identifier
84 + * @param serviceClass service class
85 + * @param <T> type of service
86 + * @return implementation class
87 + * @throws org.onlab.util.ItemNotFoundException if no such network found
88 + * @throws org.onlab.osgi.ServiceNotFoundException if no implementation found
89 + */
90 + <T> T get(NetworkId networkId, Class<T> serviceClass);
91 +
92 +}
1 +/*
2 + * Copyright 2015 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.incubator.net.virtual;
17 +
18 +import com.google.common.annotations.Beta;
19 +import org.onosproject.net.Port;
20 +
21 +/**
22 + * Representation of a virtual port.
23 + */
24 +@Beta
25 +public interface VirtualPort extends Port {
26 +
27 + /**
28 + * Returns the underlying port using which this port is realized.
29 + *
30 + * @return underlying port which realizes this virtual port
31 + */
32 + Port realizedBy();
33 +
34 +}
1 +/*
2 + * Copyright 2015 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 + * Network virtualization data models and services.
19 + */
20 +package org.onosproject.incubator.net.virtual;
...\ No newline at end of file ...\ No newline at end of file