Committed by
Gerrit Code Review
ONOS-685: Network Configuration Manager support for Segment Routing application
Change-Id: Ia15bfd24559dd5542633c8b76d500b2d31362340
Showing
25 changed files
with
1097 additions
and
135 deletions
apps/grouphandler/src/main/java/org/onosproject/grouphandler/DefaultGroupHandlerApp.java
deleted
100644 → 0
This diff is collapsed. Click to expand it.
... | @@ -45,7 +45,6 @@ | ... | @@ -45,7 +45,6 @@ |
45 | <module>reactive-routing</module> | 45 | <module>reactive-routing</module> |
46 | <module>bgprouter</module> | 46 | <module>bgprouter</module> |
47 | <module>test</module> | 47 | <module>test</module> |
48 | - <module>grouphandler</module> | ||
49 | <module>segmentrouting</module> | 48 | <module>segmentrouting</module> |
50 | </modules> | 49 | </modules> |
51 | 50 | ... | ... |
... | @@ -19,7 +19,6 @@ import org.onlab.packet.ARP; | ... | @@ -19,7 +19,6 @@ import org.onlab.packet.ARP; |
19 | import org.onlab.packet.Ethernet; | 19 | import org.onlab.packet.Ethernet; |
20 | import org.onlab.packet.Ip4Address; | 20 | import org.onlab.packet.Ip4Address; |
21 | import org.onlab.packet.IpAddress; | 21 | import org.onlab.packet.IpAddress; |
22 | -import org.onlab.packet.IpPrefix; | ||
23 | import org.onlab.packet.MacAddress; | 22 | import org.onlab.packet.MacAddress; |
24 | import org.onosproject.net.ConnectPoint; | 23 | import org.onosproject.net.ConnectPoint; |
25 | import org.onosproject.net.DeviceId; | 24 | import org.onosproject.net.DeviceId; |
... | @@ -36,7 +35,7 @@ import org.slf4j.Logger; | ... | @@ -36,7 +35,7 @@ import org.slf4j.Logger; |
36 | import org.slf4j.LoggerFactory; | 35 | import org.slf4j.LoggerFactory; |
37 | 36 | ||
38 | import java.nio.ByteBuffer; | 37 | import java.nio.ByteBuffer; |
39 | - | 38 | +import java.util.List; |
40 | import static com.google.common.base.Preconditions.checkNotNull; | 39 | import static com.google.common.base.Preconditions.checkNotNull; |
41 | 40 | ||
42 | public class ArpHandler { | 41 | public class ArpHandler { |
... | @@ -112,11 +111,11 @@ public class ArpHandler { | ... | @@ -112,11 +111,11 @@ public class ArpHandler { |
112 | 111 | ||
113 | 112 | ||
114 | private boolean isArpReqForRouter(DeviceId deviceId, ARP arpRequest) { | 113 | private boolean isArpReqForRouter(DeviceId deviceId, ARP arpRequest) { |
115 | - Ip4Address gatewayIpAddress = config.getGatewayIpAddress(deviceId); | 114 | + List<Ip4Address> gatewayIpAddresses = config.getGatewayIpAddress(deviceId); |
116 | - if (gatewayIpAddress != null) { | 115 | + if (gatewayIpAddresses != null) { |
117 | Ip4Address targetProtocolAddress = Ip4Address.valueOf(arpRequest | 116 | Ip4Address targetProtocolAddress = Ip4Address.valueOf(arpRequest |
118 | .getTargetProtocolAddress()); | 117 | .getTargetProtocolAddress()); |
119 | - if (gatewayIpAddress.equals(targetProtocolAddress)) { | 118 | + if (gatewayIpAddresses.contains(targetProtocolAddress)) { |
120 | return true; | 119 | return true; |
121 | } | 120 | } |
122 | } | 121 | } |
... | @@ -124,15 +123,11 @@ public class ArpHandler { | ... | @@ -124,15 +123,11 @@ public class ArpHandler { |
124 | } | 123 | } |
125 | 124 | ||
126 | private boolean isArpReqForSubnet(DeviceId deviceId, ARP arpRequest) { | 125 | private boolean isArpReqForSubnet(DeviceId deviceId, ARP arpRequest) { |
127 | - String subnetInfo = config.getSubnetInfo(deviceId); | 126 | + return config.getSubnetInfo(deviceId).stream() |
128 | - if (subnetInfo != null) { | 127 | + .anyMatch((prefix)-> |
129 | - IpPrefix prefix = IpPrefix.valueOf(subnetInfo); | 128 | + prefix.contains(Ip4Address. |
130 | - if (prefix.contains(Ip4Address.valueOf(arpRequest.getTargetProtocolAddress()))) { | 129 | + valueOf(arpRequest. |
131 | - return true; | 130 | + getTargetProtocolAddress()))); |
132 | - } | ||
133 | - } | ||
134 | - | ||
135 | - return false; | ||
136 | } | 131 | } |
137 | 132 | ||
138 | /** | 133 | /** | ... | ... |
... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.segmentrouting; | 16 | package org.onosproject.segmentrouting; |
17 | 17 | ||
18 | +import org.onlab.packet.Ip4Prefix; | ||
18 | import org.onlab.packet.IpPrefix; | 19 | import org.onlab.packet.IpPrefix; |
19 | import org.onosproject.net.Device; | 20 | import org.onosproject.net.Device; |
20 | import org.onosproject.net.DeviceId; | 21 | import org.onosproject.net.DeviceId; |
... | @@ -26,6 +27,7 @@ import org.slf4j.LoggerFactory; | ... | @@ -26,6 +27,7 @@ import org.slf4j.LoggerFactory; |
26 | import java.util.ArrayList; | 27 | import java.util.ArrayList; |
27 | import java.util.HashMap; | 28 | import java.util.HashMap; |
28 | import java.util.HashSet; | 29 | import java.util.HashSet; |
30 | +import java.util.List; | ||
29 | import java.util.Set; | 31 | import java.util.Set; |
30 | 32 | ||
31 | import static com.google.common.base.Preconditions.checkNotNull; | 33 | import static com.google.common.base.Preconditions.checkNotNull; |
... | @@ -139,8 +141,11 @@ public class DefaultRoutingHandler { | ... | @@ -139,8 +141,11 @@ public class DefaultRoutingHandler { |
139 | // If both target switch and dest switch are edge routers, then set IP rule | 141 | // If both target switch and dest switch are edge routers, then set IP rule |
140 | // for both subnet and router IP. | 142 | // for both subnet and router IP. |
141 | if (config.isEdgeRouter(targetSw) && config.isEdgeRouter(destSw)) { | 143 | if (config.isEdgeRouter(targetSw) && config.isEdgeRouter(destSw)) { |
142 | - String subnets = config.getSubnetInfo(destSw); | 144 | + List<Ip4Prefix> subnets = config.getSubnetInfo(destSw); |
143 | - result = rulePopulator.populateIpRuleForSubnet(targetSw, subnets, destSw, nextHops); | 145 | + result = rulePopulator.populateIpRuleForSubnet(targetSw, |
146 | + subnets, | ||
147 | + destSw, | ||
148 | + nextHops); | ||
144 | if (!result) { | 149 | if (!result) { |
145 | return false; | 150 | return false; |
146 | } | 151 | } | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -16,7 +16,7 @@ | ... | @@ -16,7 +16,7 @@ |
16 | package org.onosproject.segmentrouting; | 16 | package org.onosproject.segmentrouting; |
17 | 17 | ||
18 | import java.nio.ByteBuffer; | 18 | import java.nio.ByteBuffer; |
19 | - | 19 | +import java.util.List; |
20 | import org.onlab.packet.Ethernet; | 20 | import org.onlab.packet.Ethernet; |
21 | import org.onlab.packet.ICMP; | 21 | import org.onlab.packet.ICMP; |
22 | import org.onlab.packet.IPv4; | 22 | import org.onlab.packet.IPv4; |
... | @@ -69,14 +69,14 @@ public class IcmpHandler { | ... | @@ -69,14 +69,14 @@ public class IcmpHandler { |
69 | DeviceId deviceId = connectPoint.deviceId(); | 69 | DeviceId deviceId = connectPoint.deviceId(); |
70 | Ip4Address destinationAddress = | 70 | Ip4Address destinationAddress = |
71 | Ip4Address.valueOf(ipv4.getDestinationAddress()); | 71 | Ip4Address.valueOf(ipv4.getDestinationAddress()); |
72 | - Ip4Address gatewayIpAddress = config.getGatewayIpAddress(deviceId); | 72 | + List<Ip4Address> gatewayIpAddresses = config.getGatewayIpAddress(deviceId); |
73 | IpPrefix routerIpPrefix = config.getRouterIpAddress(deviceId); | 73 | IpPrefix routerIpPrefix = config.getRouterIpAddress(deviceId); |
74 | Ip4Address routerIpAddress = routerIpPrefix.getIp4Prefix().address(); | 74 | Ip4Address routerIpAddress = routerIpPrefix.getIp4Prefix().address(); |
75 | 75 | ||
76 | // ICMP to the router IP or gateway IP | 76 | // ICMP to the router IP or gateway IP |
77 | if (((ICMP) ipv4.getPayload()).getIcmpType() == ICMP.TYPE_ECHO_REQUEST && | 77 | if (((ICMP) ipv4.getPayload()).getIcmpType() == ICMP.TYPE_ECHO_REQUEST && |
78 | (destinationAddress.equals(routerIpAddress) || | 78 | (destinationAddress.equals(routerIpAddress) || |
79 | - gatewayIpAddress.equals(destinationAddress))) { | 79 | + gatewayIpAddresses.contains(destinationAddress))) { |
80 | sendICMPResponse(ethernet, connectPoint); | 80 | sendICMPResponse(ethernet, connectPoint); |
81 | // TODO: do we need to set the flow rule again ?? | 81 | // TODO: do we need to set the flow rule again ?? |
82 | 82 | ... | ... |
... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
16 | package org.onosproject.segmentrouting; | 16 | package org.onosproject.segmentrouting; |
17 | 17 | ||
18 | import com.google.common.collect.Lists; | 18 | import com.google.common.collect.Lists; |
19 | + | ||
19 | import org.onlab.packet.Ip4Address; | 20 | import org.onlab.packet.Ip4Address; |
20 | import org.onlab.packet.Ip4Prefix; | 21 | import org.onlab.packet.Ip4Prefix; |
21 | import org.onlab.packet.IpPrefix; | 22 | import org.onlab.packet.IpPrefix; |
... | @@ -26,39 +27,33 @@ import org.onosproject.net.PortNumber; | ... | @@ -26,39 +27,33 @@ import org.onosproject.net.PortNumber; |
26 | import org.slf4j.Logger; | 27 | import org.slf4j.Logger; |
27 | import org.slf4j.LoggerFactory; | 28 | import org.slf4j.LoggerFactory; |
28 | 29 | ||
29 | -import java.net.URI; | ||
30 | import java.util.List; | 30 | import java.util.List; |
31 | import java.util.Set; | 31 | import java.util.Set; |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * This class is temporary class and used only for test. | 34 | * This class is temporary class and used only for test. |
35 | * It will be replaced with "real" Network Config Manager. | 35 | * It will be replaced with "real" Network Config Manager. |
36 | + * | ||
37 | + * TODO: Knock off this wrapper and directly use DeviceConfiguration class | ||
36 | */ | 38 | */ |
37 | 39 | ||
38 | public class NetworkConfigHandler { | 40 | public class NetworkConfigHandler { |
39 | 41 | ||
40 | private static Logger log = LoggerFactory.getLogger(NetworkConfigHandler.class); | 42 | private static Logger log = LoggerFactory.getLogger(NetworkConfigHandler.class); |
41 | private SegmentRoutingManager srManager; | 43 | private SegmentRoutingManager srManager; |
42 | - private DeviceConfiguration deviceConfig = new DeviceConfiguration(); | 44 | + private DeviceConfiguration deviceConfig; |
43 | 45 | ||
44 | - public NetworkConfigHandler(SegmentRoutingManager srManager) { | 46 | + public NetworkConfigHandler(SegmentRoutingManager srManager, |
47 | + DeviceConfiguration deviceConfig) { | ||
45 | this.srManager = srManager; | 48 | this.srManager = srManager; |
49 | + this.deviceConfig = deviceConfig; | ||
46 | } | 50 | } |
47 | 51 | ||
48 | - public Ip4Address getGatewayIpAddress(DeviceId deviceId) { | 52 | + public List<Ip4Address> getGatewayIpAddress(DeviceId deviceId) { |
49 | - | 53 | + return this.deviceConfig.getSubnetGatewayIps(deviceId); |
50 | - if (deviceId.uri().equals(URI.create("of:0000000000000001"))) { | ||
51 | - return Ip4Address.valueOf("10.0.1.128"); | ||
52 | - } else if (deviceId.uri().equals(URI.create("of:0000000000000006"))) { | ||
53 | - return Ip4Address.valueOf("7.7.7.128"); | ||
54 | - } | ||
55 | - | ||
56 | - log.warn("No gateway Ip address was found for {}", deviceId); | ||
57 | - return Ip4Address.valueOf("0.0.0.0"); | ||
58 | } | 54 | } |
59 | 55 | ||
60 | public IpPrefix getRouterIpAddress(DeviceId deviceId) { | 56 | public IpPrefix getRouterIpAddress(DeviceId deviceId) { |
61 | - | ||
62 | return IpPrefix.valueOf(deviceConfig.getRouterIp(deviceId), 32); | 57 | return IpPrefix.valueOf(deviceConfig.getRouterIp(deviceId), 32); |
63 | } | 58 | } |
64 | 59 | ||
... | @@ -68,17 +63,13 @@ public class NetworkConfigHandler { | ... | @@ -68,17 +63,13 @@ public class NetworkConfigHandler { |
68 | 63 | ||
69 | public boolean inSameSubnet(DeviceId deviceId, Ip4Address destIp) { | 64 | public boolean inSameSubnet(DeviceId deviceId, Ip4Address destIp) { |
70 | 65 | ||
71 | - String subnetInfo = getSubnetInfo(deviceId); | 66 | + List<Ip4Prefix> subnets = getSubnetInfo(deviceId); |
72 | - if (subnetInfo == null) { | 67 | + if (subnets == null) { |
73 | return false; | 68 | return false; |
74 | } | 69 | } |
75 | 70 | ||
76 | - IpPrefix prefix = IpPrefix.valueOf(subnetInfo); | 71 | + return subnets.stream() |
77 | - if (prefix.contains(destIp)) { | 72 | + .anyMatch((subnet) -> subnet.contains(destIp)); |
78 | - return true; | ||
79 | - } | ||
80 | - | ||
81 | - return false; | ||
82 | } | 73 | } |
83 | 74 | ||
84 | public boolean inSameSubnet(Ip4Address address, int sid) { | 75 | public boolean inSameSubnet(Ip4Address address, int sid) { |
... | @@ -88,43 +79,23 @@ public class NetworkConfigHandler { | ... | @@ -88,43 +79,23 @@ public class NetworkConfigHandler { |
88 | return false; | 79 | return false; |
89 | } | 80 | } |
90 | 81 | ||
91 | - String subnetInfo = getSubnetInfo(deviceId); | 82 | + return inSameSubnet(deviceId, address); |
92 | - if (subnetInfo == null) { | ||
93 | - log.warn("Cannot find the subnet info for {}", deviceId); | ||
94 | - return false; | ||
95 | - } | ||
96 | - | ||
97 | - Ip4Prefix subnet = Ip4Prefix.valueOf(subnetInfo); | ||
98 | - if (subnet.contains(address)) { | ||
99 | - return true; | ||
100 | - } | ||
101 | - | ||
102 | - return false; | ||
103 | - | ||
104 | } | 83 | } |
105 | 84 | ||
106 | - public String getSubnetInfo(DeviceId deviceId) { | 85 | + public List<Ip4Prefix> getSubnetInfo(DeviceId deviceId) { |
107 | - // TODO : supports multiple subnet | 86 | + return deviceConfig.getSubnets(deviceId); |
108 | - if (deviceId.uri().equals(URI.create("of:0000000000000001"))) { | ||
109 | - return "10.0.1.1/24"; | ||
110 | - } else if (deviceId.uri().equals(URI.create("of:0000000000000006"))) { | ||
111 | - return "7.7.7.7/24"; | ||
112 | - } else { | ||
113 | - log.error("Switch {} is not an edge router", deviceId); | ||
114 | - return null; | ||
115 | - } | ||
116 | } | 87 | } |
117 | 88 | ||
118 | public int getMplsId(DeviceId deviceId) { | 89 | public int getMplsId(DeviceId deviceId) { |
119 | return deviceConfig.getSegmentId(deviceId); | 90 | return deviceConfig.getSegmentId(deviceId); |
120 | } | 91 | } |
121 | 92 | ||
122 | - public int getMplsId(MacAddress mac) { | 93 | + public int getMplsId(MacAddress routerMac) { |
123 | - return deviceConfig.getSegmentId(mac); | 94 | + return deviceConfig.getSegmentId(routerMac); |
124 | } | 95 | } |
125 | 96 | ||
126 | - public int getMplsId(Ip4Address address) { | 97 | + public int getMplsId(Ip4Address routerIpAddress) { |
127 | - return deviceConfig.getSegmentId(address); | 98 | + return deviceConfig.getSegmentId(routerIpAddress); |
128 | } | 99 | } |
129 | 100 | ||
130 | public boolean isEcmpNotSupportedInTransit(DeviceId deviceId) { | 101 | public boolean isEcmpNotSupportedInTransit(DeviceId deviceId) { |
... | @@ -132,17 +103,12 @@ public class NetworkConfigHandler { | ... | @@ -132,17 +103,12 @@ public class NetworkConfigHandler { |
132 | } | 103 | } |
133 | 104 | ||
134 | public boolean isTransitRouter(DeviceId deviceId) { | 105 | public boolean isTransitRouter(DeviceId deviceId) { |
135 | - return true; | 106 | + return !(deviceConfig.isEdgeDevice(deviceId)); |
136 | } | 107 | } |
137 | 108 | ||
138 | 109 | ||
139 | public boolean isEdgeRouter(DeviceId deviceId) { | 110 | public boolean isEdgeRouter(DeviceId deviceId) { |
140 | - if (deviceId.uri().equals(URI.create("of:0000000000000001")) | 111 | + return deviceConfig.isEdgeDevice(deviceId); |
141 | - || deviceId.uri().equals(URI.create("of:0000000000000006"))) { | ||
142 | - return true; | ||
143 | - } | ||
144 | - | ||
145 | - return false; | ||
146 | } | 112 | } |
147 | 113 | ||
148 | private List<PortNumber> getPortsToNeighbors(DeviceId deviceId, List<DeviceId> fwdSws) { | 114 | private List<PortNumber> getPortsToNeighbors(DeviceId deviceId, List<DeviceId> fwdSws) { |
... | @@ -177,16 +143,7 @@ public class NetworkConfigHandler { | ... | @@ -177,16 +143,7 @@ public class NetworkConfigHandler { |
177 | 143 | ||
178 | 144 | ||
179 | public Ip4Address getDestinationRouterAddress(Ip4Address destIpAddress) { | 145 | public Ip4Address getDestinationRouterAddress(Ip4Address destIpAddress) { |
180 | - // TODO: need to check the subnet info | 146 | + return deviceConfig.getRouterIpAddressForASubnetHost(destIpAddress); |
181 | - if (destIpAddress.toString().equals("10.0.1.1")) { | ||
182 | - return Ip4Address.valueOf("192.168.0.1"); | ||
183 | - } else if (destIpAddress.toString().equals("7.7.7.7")) { | ||
184 | - return Ip4Address.valueOf("192.168.0.6"); | ||
185 | - } else { | ||
186 | - log.warn("No router was found for {}", destIpAddress); | ||
187 | - return null; | ||
188 | - } | ||
189 | - | ||
190 | } | 147 | } |
191 | 148 | ||
192 | public DeviceId getDeviceId(Ip4Address ip4Address) { | 149 | public DeviceId getDeviceId(Ip4Address ip4Address) { |
... | @@ -194,13 +151,6 @@ public class NetworkConfigHandler { | ... | @@ -194,13 +151,6 @@ public class NetworkConfigHandler { |
194 | } | 151 | } |
195 | 152 | ||
196 | public MacAddress getRouterMac(Ip4Address targetAddress) { | 153 | public MacAddress getRouterMac(Ip4Address targetAddress) { |
197 | - if (targetAddress.toString().equals("10.0.1.128")) { | 154 | + return deviceConfig.getRouterMacForAGatewayIp(targetAddress); |
198 | - return MacAddress.valueOf("00:00:00:00:00:01"); | ||
199 | - } else if (targetAddress.toString().equals("7.7.7.128")) { | ||
200 | - return MacAddress.valueOf("00:00:00:00:00:06"); | ||
201 | - } else { | ||
202 | - log.warn("Cannot find a router for {}", targetAddress); | ||
203 | - return null; | ||
204 | - } | ||
205 | } | 155 | } |
206 | } | 156 | } | ... | ... |
... | @@ -17,11 +17,11 @@ package org.onosproject.segmentrouting; | ... | @@ -17,11 +17,11 @@ package org.onosproject.segmentrouting; |
17 | 17 | ||
18 | import org.onlab.packet.Ethernet; | 18 | import org.onlab.packet.Ethernet; |
19 | import org.onlab.packet.Ip4Address; | 19 | import org.onlab.packet.Ip4Address; |
20 | +import org.onlab.packet.Ip4Prefix; | ||
20 | import org.onlab.packet.IpPrefix; | 21 | import org.onlab.packet.IpPrefix; |
21 | import org.onlab.packet.MacAddress; | 22 | import org.onlab.packet.MacAddress; |
22 | - | ||
23 | import org.onlab.packet.MplsLabel; | 23 | import org.onlab.packet.MplsLabel; |
24 | -import org.onosproject.grouphandler.NeighborSet; | 24 | +import org.onosproject.segmentrouting.grouphandler.NeighborSet; |
25 | import org.onosproject.net.DeviceId; | 25 | import org.onosproject.net.DeviceId; |
26 | import org.onosproject.net.Link; | 26 | import org.onosproject.net.Link; |
27 | import org.onosproject.net.PortNumber; | 27 | import org.onosproject.net.PortNumber; |
... | @@ -94,15 +94,15 @@ public class RoutingRulePopulator { | ... | @@ -94,15 +94,15 @@ public class RoutingRulePopulator { |
94 | * Populates IP flow rules for the subnets of the destination router. | 94 | * Populates IP flow rules for the subnets of the destination router. |
95 | * | 95 | * |
96 | * @param deviceId switch ID to set the rules | 96 | * @param deviceId switch ID to set the rules |
97 | - * @param subnetInfo subnet information | 97 | + * @param subnets subnet information |
98 | * @param destSw destination switch ID | 98 | * @param destSw destination switch ID |
99 | * @param nextHops next hop switch ID list | 99 | * @param nextHops next hop switch ID list |
100 | * @return true if all rules are set successfully, false otherwise | 100 | * @return true if all rules are set successfully, false otherwise |
101 | */ | 101 | */ |
102 | - public boolean populateIpRuleForSubnet(DeviceId deviceId, String subnetInfo, | 102 | + public boolean populateIpRuleForSubnet(DeviceId deviceId, List<Ip4Prefix> subnets, |
103 | DeviceId destSw, Set<DeviceId> nextHops) { | 103 | DeviceId destSw, Set<DeviceId> nextHops) { |
104 | 104 | ||
105 | - List<IpPrefix> subnets = extractSubnet(subnetInfo); | 105 | + //List<IpPrefix> subnets = extractSubnet(subnetInfo); |
106 | for (IpPrefix subnet: subnets) { | 106 | for (IpPrefix subnet: subnets) { |
107 | if (!populateIpRuleForRouter(deviceId, subnet, destSw, nextHops)) { | 107 | if (!populateIpRuleForRouter(deviceId, subnet, destSw, nextHops)) { |
108 | return false; | 108 | return false; |
... | @@ -371,21 +371,6 @@ public class RoutingRulePopulator { | ... | @@ -371,21 +371,6 @@ public class RoutingRulePopulator { |
371 | 371 | ||
372 | } | 372 | } |
373 | 373 | ||
374 | - | ||
375 | - private List<IpPrefix> extractSubnet(String subnetInfo) { | ||
376 | - List<IpPrefix> subnetIpPrefixes = new ArrayList<>(); | ||
377 | - | ||
378 | - // TODO: refactoring required depending on the format of the subnet info | ||
379 | - IpPrefix prefix = IpPrefix.valueOf(subnetInfo); | ||
380 | - if (prefix == null) { | ||
381 | - log.error("Wrong ip prefix type {}", subnetInfo); | ||
382 | - } else { | ||
383 | - subnetIpPrefixes.add(prefix); | ||
384 | - } | ||
385 | - | ||
386 | - return subnetIpPrefixes; | ||
387 | - } | ||
388 | - | ||
389 | private Link selectOneLink(DeviceId srcId, Set<DeviceId> destIds) { | 374 | private Link selectOneLink(DeviceId srcId, Set<DeviceId> destIds) { |
390 | 375 | ||
391 | Set<Link> links = srManager.linkService.getDeviceEgressLinks(srcId); | 376 | Set<Link> links = srManager.linkService.getDeviceEgressLinks(srcId); | ... | ... |
... | @@ -25,8 +25,8 @@ import org.onlab.packet.IPv4; | ... | @@ -25,8 +25,8 @@ import org.onlab.packet.IPv4; |
25 | import org.onosproject.core.ApplicationId; | 25 | import org.onosproject.core.ApplicationId; |
26 | import org.onosproject.core.CoreService; | 26 | import org.onosproject.core.CoreService; |
27 | import org.onosproject.event.Event; | 27 | import org.onosproject.event.Event; |
28 | -import org.onosproject.grouphandler.DefaultGroupHandler; | 28 | +import org.onosproject.segmentrouting.grouphandler.DefaultGroupHandler; |
29 | -import org.onosproject.grouphandler.NeighborSet; | 29 | +import org.onosproject.segmentrouting.grouphandler.NeighborSet; |
30 | import org.onosproject.mastership.MastershipService; | 30 | import org.onosproject.mastership.MastershipService; |
31 | import org.onosproject.net.Device; | 31 | import org.onosproject.net.Device; |
32 | import org.onosproject.net.DeviceId; | 32 | import org.onosproject.net.DeviceId; |
... | @@ -52,6 +52,7 @@ import org.onosproject.net.packet.PacketContext; | ... | @@ -52,6 +52,7 @@ import org.onosproject.net.packet.PacketContext; |
52 | import org.onosproject.net.packet.PacketProcessor; | 52 | import org.onosproject.net.packet.PacketProcessor; |
53 | import org.onosproject.net.packet.PacketService; | 53 | import org.onosproject.net.packet.PacketService; |
54 | import org.onosproject.net.topology.TopologyService; | 54 | import org.onosproject.net.topology.TopologyService; |
55 | +import org.onosproject.segmentrouting.config.NetworkConfigManager; | ||
55 | import org.slf4j.Logger; | 56 | import org.slf4j.Logger; |
56 | import org.slf4j.LoggerFactory; | 57 | import org.slf4j.LoggerFactory; |
57 | 58 | ||
... | @@ -98,16 +99,15 @@ public class SegmentRoutingManager { | ... | @@ -98,16 +99,15 @@ public class SegmentRoutingManager { |
98 | 99 | ||
99 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 100 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
100 | protected MastershipService mastershipService; | 101 | protected MastershipService mastershipService; |
101 | - | 102 | + protected NetworkConfigHandler networkConfigHandler = null; |
102 | - protected NetworkConfigHandler networkConfigHandler = new NetworkConfigHandler(this); | 103 | + protected ArpHandler arpHandler = null; |
103 | - protected ArpHandler arpHandler = new ArpHandler(this); | 104 | + protected IcmpHandler icmpHandler = null; |
104 | - protected IcmpHandler icmpHandler = new IcmpHandler(this); | 105 | + protected IpHandler ipHandler = null; |
105 | - protected IpHandler ipHandler = new IpHandler(this); | 106 | + protected RoutingRulePopulator routingRulePopulator = null; |
106 | - protected RoutingRulePopulator routingRulePopulator = new RoutingRulePopulator(this); | ||
107 | protected ApplicationId appId; | 107 | protected ApplicationId appId; |
108 | 108 | ||
109 | - private DefaultRoutingHandler defaultRoutingHandler = new DefaultRoutingHandler(this); | 109 | + private DefaultRoutingHandler defaultRoutingHandler = null; |
110 | - private DeviceConfiguration deviceConfiguration = new DeviceConfiguration(); | 110 | + private DeviceConfiguration deviceConfiguration = null; |
111 | private InternalPacketProcessor processor = new InternalPacketProcessor(); | 111 | private InternalPacketProcessor processor = new InternalPacketProcessor(); |
112 | private InternalEventHandler eventHandler = new InternalEventHandler(); | 112 | private InternalEventHandler eventHandler = new InternalEventHandler(); |
113 | 113 | ||
... | @@ -118,6 +118,8 @@ public class SegmentRoutingManager { | ... | @@ -118,6 +118,8 @@ public class SegmentRoutingManager { |
118 | private Map<DeviceId, DefaultGroupHandler> groupHandlerMap | 118 | private Map<DeviceId, DefaultGroupHandler> groupHandlerMap |
119 | = new ConcurrentHashMap<DeviceId, DefaultGroupHandler>(); | 119 | = new ConcurrentHashMap<DeviceId, DefaultGroupHandler>(); |
120 | 120 | ||
121 | + private NetworkConfigManager networkConfigService = new NetworkConfigManager();; | ||
122 | + | ||
121 | private static int numOfEvents = 0; | 123 | private static int numOfEvents = 0; |
122 | private static int numOfHandlerExecution = 0; | 124 | private static int numOfHandlerExecution = 0; |
123 | private static int numOfHandlerScheduled = 0; | 125 | private static int numOfHandlerScheduled = 0; |
... | @@ -125,6 +127,16 @@ public class SegmentRoutingManager { | ... | @@ -125,6 +127,16 @@ public class SegmentRoutingManager { |
125 | @Activate | 127 | @Activate |
126 | protected void activate() { | 128 | protected void activate() { |
127 | appId = coreService.registerApplication("org.onosproject.segmentrouting"); | 129 | appId = coreService.registerApplication("org.onosproject.segmentrouting"); |
130 | + networkConfigService.init(); | ||
131 | + deviceConfiguration = new DeviceConfiguration(networkConfigService); | ||
132 | + networkConfigHandler = new NetworkConfigHandler(this, | ||
133 | + deviceConfiguration); | ||
134 | + arpHandler = new ArpHandler(this); | ||
135 | + icmpHandler = new IcmpHandler(this); | ||
136 | + ipHandler = new IpHandler(this); | ||
137 | + routingRulePopulator = new RoutingRulePopulator(this); | ||
138 | + defaultRoutingHandler = new DefaultRoutingHandler(this); | ||
139 | + | ||
128 | packetService.addProcessor(processor, PacketProcessor.ADVISOR_MAX + 2); | 140 | packetService.addProcessor(processor, PacketProcessor.ADVISOR_MAX + 2); |
129 | linkService.addListener(new InternalLinkListener()); | 141 | linkService.addListener(new InternalLinkListener()); |
130 | groupService.addListener(new InternalGroupListener()); | 142 | groupService.addListener(new InternalGroupListener()); |
... | @@ -271,6 +283,7 @@ public class SegmentRoutingManager { | ... | @@ -271,6 +283,7 @@ public class SegmentRoutingManager { |
271 | 283 | ||
272 | private class InternalEventHandler implements Runnable { | 284 | private class InternalEventHandler implements Runnable { |
273 | 285 | ||
286 | + @Override | ||
274 | public void run() { | 287 | public void run() { |
275 | numOfHandlerExecution++; | 288 | numOfHandlerExecution++; |
276 | while (!eventQueue.isEmpty()) { | 289 | while (!eventQueue.isEmpty()) { |
... | @@ -326,7 +339,11 @@ public class SegmentRoutingManager { | ... | @@ -326,7 +339,11 @@ public class SegmentRoutingManager { |
326 | log.debug("A new device with ID {} was added", device.id()); | 339 | log.debug("A new device with ID {} was added", device.id()); |
327 | defaultRoutingHandler.populateTtpRules(device.id()); | 340 | defaultRoutingHandler.populateTtpRules(device.id()); |
328 | DefaultGroupHandler dgh = DefaultGroupHandler.createGroupHandler( | 341 | DefaultGroupHandler dgh = DefaultGroupHandler.createGroupHandler( |
329 | - device.id(), appId, new DeviceConfiguration(), linkService, groupService); | 342 | + device.id(), |
343 | + appId, | ||
344 | + deviceConfiguration, | ||
345 | + linkService, | ||
346 | + groupService); | ||
330 | dgh.createGroups(); | 347 | dgh.createGroups(); |
331 | groupHandlerMap.put(device.id(), dgh); | 348 | groupHandlerMap.put(device.id(), dgh); |
332 | } | 349 | } | ... | ... |
apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfig.java
0 → 100644
1 | +package org.onosproject.segmentrouting.config; | ||
2 | + | ||
3 | +import java.util.ArrayList; | ||
4 | +import java.util.List; | ||
5 | +import java.util.Map; | ||
6 | + | ||
7 | +import org.onosproject.net.DeviceId; | ||
8 | +import org.slf4j.Logger; | ||
9 | +import org.slf4j.LoggerFactory; | ||
10 | + | ||
11 | +import com.fasterxml.jackson.annotation.JsonProperty; | ||
12 | +import com.fasterxml.jackson.databind.JsonNode; | ||
13 | + | ||
14 | +/** | ||
15 | + * Public class corresponding to JSON described data model. Defines the network | ||
16 | + * configuration at startup. | ||
17 | + */ | ||
18 | +public class NetworkConfig { | ||
19 | + protected static final Logger log = LoggerFactory.getLogger(NetworkConfig.class); | ||
20 | + | ||
21 | + @SuppressWarnings("unused") | ||
22 | + private String comment; | ||
23 | + | ||
24 | + private Boolean restrictSwitches; | ||
25 | + private Boolean restrictLinks; | ||
26 | + private List<SwitchConfig> switches; | ||
27 | + private List<LinkConfig> links; | ||
28 | + | ||
29 | + /** | ||
30 | + * Default constructor. | ||
31 | + */ | ||
32 | + public NetworkConfig() { | ||
33 | + switches = new ArrayList<SwitchConfig>(); | ||
34 | + links = new ArrayList<LinkConfig>(); | ||
35 | + } | ||
36 | + | ||
37 | + @JsonProperty("comment") | ||
38 | + public void setComment(String c) { | ||
39 | + log.trace("NetworkConfig: comment={}", c); | ||
40 | + comment = c; | ||
41 | + } | ||
42 | + | ||
43 | + @JsonProperty("restrictSwitches") | ||
44 | + public void setRestrictSwitches(boolean rs) { | ||
45 | + log.trace("NetworkConfig: restrictSwitches={}", rs); | ||
46 | + restrictSwitches = rs; | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * Returns default restrict configuration for switches. | ||
51 | + * | ||
52 | + * @return boolean | ||
53 | + */ | ||
54 | + public Boolean getRestrictSwitches() { | ||
55 | + return restrictSwitches; | ||
56 | + } | ||
57 | + | ||
58 | + @JsonProperty("restrictLinks") | ||
59 | + public void setRestrictLinks(boolean rl) { | ||
60 | + log.trace("NetworkConfig: restrictLinks={}", rl); | ||
61 | + restrictLinks = rl; | ||
62 | + } | ||
63 | + | ||
64 | + /** | ||
65 | + * Returns default restrict configuration for links. | ||
66 | + * | ||
67 | + * @return boolean | ||
68 | + */ | ||
69 | + public Boolean getRestrictLinks() { | ||
70 | + return restrictLinks; | ||
71 | + } | ||
72 | + | ||
73 | + /** | ||
74 | + * Returns configuration for switches. | ||
75 | + * | ||
76 | + * @return list of switch configuration | ||
77 | + */ | ||
78 | + public List<SwitchConfig> getSwitchConfig() { | ||
79 | + return switches; | ||
80 | + } | ||
81 | + | ||
82 | + @JsonProperty("switchConfig") | ||
83 | + public void setSwitchConfig(List<SwitchConfig> switches2) { | ||
84 | + log.trace("NetworkConfig: switchConfig={}", switches2); | ||
85 | + this.switches = switches2; | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * Java class corresponding to JSON described switch | ||
90 | + * configuration data model. | ||
91 | + */ | ||
92 | + public static class SwitchConfig { | ||
93 | + protected String nodeDpid; | ||
94 | + protected String name; | ||
95 | + protected String type; | ||
96 | + protected boolean allowed; | ||
97 | + protected double latitude; | ||
98 | + protected double longitude; | ||
99 | + protected Map<String, JsonNode> params; | ||
100 | + protected Map<String, String> publishAttributes; | ||
101 | + protected DeviceId dpid; | ||
102 | + | ||
103 | + /** | ||
104 | + * Returns the configured "name" of a switch. | ||
105 | + * | ||
106 | + * @return string | ||
107 | + */ | ||
108 | + public String getName() { | ||
109 | + return name; | ||
110 | + } | ||
111 | + | ||
112 | + @JsonProperty("name") | ||
113 | + public void setName(String name) { | ||
114 | + log.trace("SwitchConfig: name={}", name); | ||
115 | + this.name = name; | ||
116 | + } | ||
117 | + | ||
118 | + /** | ||
119 | + * Returns the data plane identifier of a switch. | ||
120 | + * | ||
121 | + * @return ONOS device identifier | ||
122 | + */ | ||
123 | + public DeviceId getDpid() { | ||
124 | + return dpid; | ||
125 | + } | ||
126 | + | ||
127 | + public void setDpid(DeviceId dpid) { | ||
128 | + this.dpid = dpid; | ||
129 | + this.nodeDpid = dpid.toString(); | ||
130 | + } | ||
131 | + | ||
132 | + /** | ||
133 | + * Returns the data plane identifier of a switch. | ||
134 | + * | ||
135 | + * @return string | ||
136 | + */ | ||
137 | + public String getNodeDpid() { | ||
138 | + return nodeDpid; | ||
139 | + } | ||
140 | + | ||
141 | + // mapper sets both DeviceId and string fields for dpid | ||
142 | + @JsonProperty("nodeDpid") | ||
143 | + public void setNodeDpid(String nodeDpid) { | ||
144 | + log.trace("SwitchConfig: nodeDpid={}", nodeDpid); | ||
145 | + this.nodeDpid = nodeDpid; | ||
146 | + this.dpid = DeviceId.deviceId(nodeDpid); | ||
147 | + } | ||
148 | + | ||
149 | + /** | ||
150 | + * Returns the type of a switch. | ||
151 | + * | ||
152 | + * @return string | ||
153 | + */ | ||
154 | + public String getType() { | ||
155 | + return type; | ||
156 | + } | ||
157 | + | ||
158 | + @JsonProperty("type") | ||
159 | + public void setType(String type) { | ||
160 | + log.trace("SwitchConfig: type={}", type); | ||
161 | + this.type = type; | ||
162 | + } | ||
163 | + | ||
164 | + /** | ||
165 | + * Returns the latitude of a switch. | ||
166 | + * | ||
167 | + * @return double | ||
168 | + */ | ||
169 | + public double getLatitude() { | ||
170 | + return latitude; | ||
171 | + } | ||
172 | + | ||
173 | + @JsonProperty("latitude") | ||
174 | + public void setLatitude(double latitude) { | ||
175 | + log.trace("SwitchConfig: latitude={}", latitude); | ||
176 | + this.latitude = latitude; | ||
177 | + } | ||
178 | + | ||
179 | + /** | ||
180 | + * Returns the longitude of a switch. | ||
181 | + * | ||
182 | + * @return double | ||
183 | + */ | ||
184 | + public double getLongitude() { | ||
185 | + return longitude; | ||
186 | + } | ||
187 | + | ||
188 | + @JsonProperty("longitude") | ||
189 | + public void setLongitude(double longitude) { | ||
190 | + log.trace("SwitchConfig: longitude={}", longitude); | ||
191 | + this.longitude = longitude; | ||
192 | + } | ||
193 | + | ||
194 | + /** | ||
195 | + * Returns the allowed flag for a switch. | ||
196 | + * | ||
197 | + * @return boolean | ||
198 | + */ | ||
199 | + public boolean isAllowed() { | ||
200 | + return allowed; | ||
201 | + } | ||
202 | + | ||
203 | + @JsonProperty("allowed") | ||
204 | + public void setAllowed(boolean allowed) { | ||
205 | + this.allowed = allowed; | ||
206 | + } | ||
207 | + | ||
208 | + /** | ||
209 | + * Returns the additional configured parameters of a switch. | ||
210 | + * | ||
211 | + * @return key value map | ||
212 | + */ | ||
213 | + public Map<String, JsonNode> getParams() { | ||
214 | + return params; | ||
215 | + } | ||
216 | + | ||
217 | + @JsonProperty("params") | ||
218 | + public void setParams(Map<String, JsonNode> params) { | ||
219 | + this.params = params; | ||
220 | + } | ||
221 | + | ||
222 | + /** | ||
223 | + * Reserved for future use. | ||
224 | + * | ||
225 | + * @return key value map | ||
226 | + */ | ||
227 | + public Map<String, String> getPublishAttributes() { | ||
228 | + return publishAttributes; | ||
229 | + } | ||
230 | + | ||
231 | + @JsonProperty("publishAttributes") | ||
232 | + public void setPublishAttributes(Map<String, String> publishAttributes) { | ||
233 | + this.publishAttributes = publishAttributes; | ||
234 | + } | ||
235 | + | ||
236 | + } | ||
237 | + | ||
238 | + @JsonProperty("linkConfig") | ||
239 | + public void setLinkConfig(List<LinkConfig> links2) { | ||
240 | + this.links = links2; | ||
241 | + } | ||
242 | + | ||
243 | + /** | ||
244 | + * Reserved for future use. | ||
245 | + * | ||
246 | + * @return list of configured link configuration | ||
247 | + */ | ||
248 | + public List<LinkConfig> getLinkConfig() { | ||
249 | + return links; | ||
250 | + } | ||
251 | + | ||
252 | + /** | ||
253 | + * Reserved for future use. | ||
254 | + */ | ||
255 | + public static class LinkConfig { | ||
256 | + protected String type; | ||
257 | + protected Boolean allowed; | ||
258 | + protected DeviceId dpid1; | ||
259 | + protected DeviceId dpid2; | ||
260 | + protected String nodeDpid1; | ||
261 | + protected String nodeDpid2; | ||
262 | + protected Map<String, JsonNode> params; | ||
263 | + protected Map<String, String> publishAttributes; | ||
264 | + | ||
265 | + public String getType() { | ||
266 | + return type; | ||
267 | + } | ||
268 | + | ||
269 | + public void setType(String type) { | ||
270 | + this.type = type; | ||
271 | + } | ||
272 | + | ||
273 | + public Boolean isAllowed() { | ||
274 | + return allowed; | ||
275 | + } | ||
276 | + | ||
277 | + public void setAllowed(Boolean allowed) { | ||
278 | + this.allowed = allowed; | ||
279 | + } | ||
280 | + | ||
281 | + public String getNodeDpid1() { | ||
282 | + return nodeDpid1; | ||
283 | + } | ||
284 | + | ||
285 | + // mapper sets both long and string fields for dpid | ||
286 | + public void setNodeDpid1(String nodeDpid1) { | ||
287 | + this.nodeDpid1 = nodeDpid1; | ||
288 | + this.dpid1 = DeviceId.deviceId(nodeDpid1); | ||
289 | + } | ||
290 | + | ||
291 | + public String getNodeDpid2() { | ||
292 | + return nodeDpid2; | ||
293 | + } | ||
294 | + | ||
295 | + // mapper sets both long and string fields for dpid | ||
296 | + public void setNodeDpid2(String nodeDpid2) { | ||
297 | + this.nodeDpid2 = nodeDpid2; | ||
298 | + this.dpid2 = DeviceId.deviceId(nodeDpid2); | ||
299 | + } | ||
300 | + | ||
301 | + public DeviceId getDpid1() { | ||
302 | + return dpid1; | ||
303 | + } | ||
304 | + | ||
305 | + public void setDpid1(DeviceId dpid1) { | ||
306 | + this.dpid1 = dpid1; | ||
307 | + this.nodeDpid1 = dpid1.toString(); | ||
308 | + } | ||
309 | + | ||
310 | + public DeviceId getDpid2() { | ||
311 | + return dpid2; | ||
312 | + } | ||
313 | + | ||
314 | + public void setDpid2(DeviceId dpid2) { | ||
315 | + this.dpid2 = dpid2; | ||
316 | + this.nodeDpid2 = dpid2.toString(); | ||
317 | + } | ||
318 | + | ||
319 | + public Map<String, JsonNode> getParams() { | ||
320 | + return params; | ||
321 | + } | ||
322 | + | ||
323 | + public void setParams(Map<String, JsonNode> params) { | ||
324 | + this.params = params; | ||
325 | + } | ||
326 | + | ||
327 | + public Map<String, String> getPublishAttributes() { | ||
328 | + return publishAttributes; | ||
329 | + } | ||
330 | + | ||
331 | + public void setPublishAttributes(Map<String, String> publishAttributes) { | ||
332 | + this.publishAttributes = publishAttributes; | ||
333 | + } | ||
334 | + } | ||
335 | +} | ||
336 | + |
apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigException.java
0 → 100644
1 | +package org.onosproject.segmentrouting.config; | ||
2 | + | ||
3 | +import org.onosproject.net.DeviceId; | ||
4 | +import org.slf4j.Logger; | ||
5 | +import org.slf4j.LoggerFactory; | ||
6 | + | ||
7 | +/** | ||
8 | + * NetworkConfigExceptions specifies a set of unchecked runtime exceptions that | ||
9 | + * can be thrown by the {@link NetworkConfigManager}. It indicates errors that | ||
10 | + * must be fixed in the config file before controller execution can proceed. | ||
11 | + */ | ||
12 | +public class NetworkConfigException extends RuntimeException { | ||
13 | + | ||
14 | + private static final long serialVersionUID = 4959684709803000652L; | ||
15 | + protected static final Logger log = LoggerFactory | ||
16 | + .getLogger(NetworkConfigException.class); | ||
17 | + | ||
18 | + /** | ||
19 | + * Exception for duplicate device identifier configuration. | ||
20 | + */ | ||
21 | + public static class DuplicateDpid extends RuntimeException { | ||
22 | + private static final long serialVersionUID = 5491113234592145335L; | ||
23 | + | ||
24 | + public DuplicateDpid(DeviceId dpid) { | ||
25 | + super(); | ||
26 | + log.error("Duplicate dpid found in switch-config Dpid:{}", | ||
27 | + dpid); | ||
28 | + } | ||
29 | + } | ||
30 | + | ||
31 | + /** | ||
32 | + * Exception for duplicate device name configuration. | ||
33 | + */ | ||
34 | + public static class DuplicateName extends RuntimeException { | ||
35 | + private static final long serialVersionUID = -4090171438031376129L; | ||
36 | + | ||
37 | + public DuplicateName(String name) { | ||
38 | + super(); | ||
39 | + log.error("Duplicate name found in switch-config name:{}", name); | ||
40 | + } | ||
41 | + } | ||
42 | + | ||
43 | + /** | ||
44 | + * Exception for unspecified device identifier for a switch. | ||
45 | + */ | ||
46 | + public static class DpidNotSpecified extends RuntimeException { | ||
47 | + private static final long serialVersionUID = -8494418855597117254L; | ||
48 | + | ||
49 | + public DpidNotSpecified(String name) { | ||
50 | + super(); | ||
51 | + log.error("Dpid not specified for switch-config name:{}", name); | ||
52 | + } | ||
53 | + } | ||
54 | + | ||
55 | + /** | ||
56 | + * Exception for unspecified device name for a switch. | ||
57 | + */ | ||
58 | + public static class NameNotSpecified extends RuntimeException { | ||
59 | + private static final long serialVersionUID = -3518881744110422891L; | ||
60 | + | ||
61 | + public NameNotSpecified(DeviceId dpid) { | ||
62 | + super(); | ||
63 | + log.error("Name not specified for switch-config dpid:{}", | ||
64 | + dpid); | ||
65 | + } | ||
66 | + } | ||
67 | + | ||
68 | + /** | ||
69 | + * Exception for unspecified device type for a switch. | ||
70 | + */ | ||
71 | + public static class SwitchTypeNotSpecified extends RuntimeException { | ||
72 | + private static final long serialVersionUID = 2527453336226053753L; | ||
73 | + | ||
74 | + public SwitchTypeNotSpecified(DeviceId dpid) { | ||
75 | + super(); | ||
76 | + log.error("Switch type not specified for switch-config dpid:{}", | ||
77 | + dpid); | ||
78 | + } | ||
79 | + } | ||
80 | + | ||
81 | + /** | ||
82 | + * Exception for unknown device type configured for a switch. | ||
83 | + */ | ||
84 | + public static class UnknownSwitchType extends RuntimeException { | ||
85 | + private static final long serialVersionUID = 7758418165512249170L; | ||
86 | + | ||
87 | + public UnknownSwitchType(String type, String name) { | ||
88 | + super(); | ||
89 | + log.error("Unknown switch type {} for switch name:{}", type, name); | ||
90 | + } | ||
91 | + } | ||
92 | + | ||
93 | + /** | ||
94 | + * Exception for missing required parameter configuration for a switch. | ||
95 | + */ | ||
96 | + public static class ParamsNotSpecified extends RuntimeException { | ||
97 | + private static final long serialVersionUID = 6247582323691265513L; | ||
98 | + | ||
99 | + public ParamsNotSpecified(String name) { | ||
100 | + super(); | ||
101 | + log.error("Params required - not specified for switch:{}", name); | ||
102 | + } | ||
103 | + } | ||
104 | + | ||
105 | + /** | ||
106 | + * Reserved for future use. | ||
107 | + */ | ||
108 | + public static class LinkTypeNotSpecified extends RuntimeException { | ||
109 | + private static final long serialVersionUID = -2089470389588542215L; | ||
110 | + | ||
111 | + public LinkTypeNotSpecified(String dpid1, String dpid2) { | ||
112 | + super(); | ||
113 | + log.error("Link type not specified for link-config between " | ||
114 | + + "dpid1:{} and dpid2:{}", dpid1, dpid2); | ||
115 | + } | ||
116 | + } | ||
117 | + | ||
118 | + /** | ||
119 | + * Reserved for future use. | ||
120 | + */ | ||
121 | + public static class LinkDpidNotSpecified extends RuntimeException { | ||
122 | + private static final long serialVersionUID = -5701825916378616004L; | ||
123 | + | ||
124 | + public LinkDpidNotSpecified(String dpid1, String dpid2) { | ||
125 | + super(); | ||
126 | + if (dpid1 == null) { | ||
127 | + log.error("nodeDpid1 not specified for link-config "); | ||
128 | + } | ||
129 | + if (dpid2 == null) { | ||
130 | + log.error("nodeDpid2 not specified for link-config "); | ||
131 | + } | ||
132 | + } | ||
133 | + } | ||
134 | + | ||
135 | + /** | ||
136 | + * Reserved for future use. | ||
137 | + */ | ||
138 | + public static class LinkForUnknownSwitchConfig extends RuntimeException { | ||
139 | + private static final long serialVersionUID = -2910458439881964094L; | ||
140 | + | ||
141 | + public LinkForUnknownSwitchConfig(String dpid) { | ||
142 | + super(); | ||
143 | + log.error("Link configuration was specified for a switch-dpid {} " | ||
144 | + + "that has not been configured", dpid); | ||
145 | + } | ||
146 | + } | ||
147 | + | ||
148 | + /** | ||
149 | + * Reserved for future use. | ||
150 | + */ | ||
151 | + public static class UnknownLinkType extends RuntimeException { | ||
152 | + private static final long serialVersionUID = -5505376193106542305L; | ||
153 | + | ||
154 | + public UnknownLinkType(String linktype, String dpid1, String dpid2) { | ||
155 | + super(); | ||
156 | + log.error("unknown link type {} for links between dpid1:{} " | ||
157 | + + "and dpid2:{}", linktype, dpid1, dpid2); | ||
158 | + } | ||
159 | + } | ||
160 | + | ||
161 | + /** | ||
162 | + * Exception for generic configuration errors. | ||
163 | + */ | ||
164 | + public static class ErrorConfig extends RuntimeException { | ||
165 | + private static final long serialVersionUID = -2827406314700193147L; | ||
166 | + | ||
167 | + public ErrorConfig(String errorMsg) { | ||
168 | + super(); | ||
169 | + log.error(errorMsg); | ||
170 | + } | ||
171 | + | ||
172 | + } | ||
173 | + | ||
174 | + /** | ||
175 | + * Reserved for future use. | ||
176 | + */ | ||
177 | + public static class SwitchDpidNotConverted extends RuntimeException { | ||
178 | + private static final long serialVersionUID = 5640347104590170426L; | ||
179 | + | ||
180 | + public SwitchDpidNotConverted(String name) { | ||
181 | + super(); | ||
182 | + log.error("Switch dpid specified as a HexString {} does not match " | ||
183 | + + "with long value", name); | ||
184 | + } | ||
185 | + } | ||
186 | + | ||
187 | + /** | ||
188 | + * Reserved for future use. | ||
189 | + */ | ||
190 | + public static class LinkDpidNotConverted extends RuntimeException { | ||
191 | + private static final long serialVersionUID = 2397245646094080774L; | ||
192 | + | ||
193 | + public LinkDpidNotConverted(String dpid1, String dpid2) { | ||
194 | + log.error("Dpids expressed as HexStrings for links between dpid1:{} " | ||
195 | + + "and dpid2:{} do not match with long values", dpid1, dpid2); | ||
196 | + } | ||
197 | + } | ||
198 | + | ||
199 | +} | ||
200 | + |
apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigManager.java
0 → 100644
This diff is collapsed. Click to expand it.
apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigService.java
0 → 100644
1 | +package org.onosproject.segmentrouting.config; | ||
2 | + | ||
3 | +import java.util.List; | ||
4 | + | ||
5 | +import org.onosproject.net.DeviceId; | ||
6 | +import org.onosproject.net.Link; | ||
7 | +import org.onosproject.segmentrouting.config.NetworkConfig.LinkConfig; | ||
8 | +import org.onosproject.segmentrouting.config.NetworkConfig.SwitchConfig; | ||
9 | + | ||
10 | +/** | ||
11 | + * Exposes methods to retrieve network configuration. | ||
12 | + * | ||
13 | + * TODO: currently only startup-configuration is exposed and such configuration | ||
14 | + * cannot be changed at runtime. Need to add runtime support for changes to | ||
15 | + * configuration (via REST/CLI) in future releases. | ||
16 | + * | ||
17 | + * TODO: return immutable objects or defensive copies of network config so that | ||
18 | + * users of this API do not inadvertently or maliciously change network config. | ||
19 | + */ | ||
20 | +public interface NetworkConfigService { | ||
21 | + | ||
22 | + /** | ||
23 | + * Suggests the action to be taken by the caller given the configuration | ||
24 | + * associated with the queried network-object (eg. switch, link etc.). | ||
25 | + */ | ||
26 | + public enum NetworkConfigState { | ||
27 | + /** | ||
28 | + * Associated network object has been configured to not be allowed in | ||
29 | + * the network. | ||
30 | + */ | ||
31 | + DENY, | ||
32 | + | ||
33 | + /** | ||
34 | + * Associated network object has been configured to be allowed in the | ||
35 | + * network. | ||
36 | + */ | ||
37 | + ACCEPT, | ||
38 | + | ||
39 | + /** | ||
40 | + * Associated network object has been configured to be allowed in the | ||
41 | + * network. In addition, there are configured parameters that should be | ||
42 | + * added to the object. | ||
43 | + */ | ||
44 | + ACCEPT_ADD, | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * Returns the configuration outcome (accept, deny etc.), and any configured | ||
49 | + * parameters to the caller, in response to a query for the configuration | ||
50 | + * associated with a switch. | ||
51 | + */ | ||
52 | + public class SwitchConfigStatus { | ||
53 | + private NetworkConfigState configState; | ||
54 | + private SwitchConfig switchConfig; | ||
55 | + private String msg; | ||
56 | + | ||
57 | + SwitchConfigStatus(NetworkConfigState configState, | ||
58 | + SwitchConfig switchConfig, String msg) { | ||
59 | + this.configState = configState; | ||
60 | + this.switchConfig = switchConfig; | ||
61 | + this.msg = msg; | ||
62 | + } | ||
63 | + | ||
64 | + SwitchConfigStatus(NetworkConfigState configState, | ||
65 | + SwitchConfig switchConfig) { | ||
66 | + this.configState = configState; | ||
67 | + this.switchConfig = switchConfig; | ||
68 | + this.msg = ""; | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * Returns the configuration state for the switch. | ||
73 | + * | ||
74 | + * @return non-null NetworkConfigState | ||
75 | + */ | ||
76 | + public NetworkConfigState getConfigState() { | ||
77 | + return configState; | ||
78 | + } | ||
79 | + | ||
80 | + /** | ||
81 | + * Returns the switch configuration, which may be null if no | ||
82 | + * configuration exists, or if the configuration state disallows the | ||
83 | + * switch. | ||
84 | + * | ||
85 | + * @return SwitchConfig, the switch configuration, or null | ||
86 | + */ | ||
87 | + public SwitchConfig getSwitchConfig() { | ||
88 | + return switchConfig; | ||
89 | + } | ||
90 | + | ||
91 | + /** | ||
92 | + * User readable string typically used to specify the reason why a | ||
93 | + * switch is being disallowed. | ||
94 | + * | ||
95 | + * @return A non-null but possibly empty String | ||
96 | + */ | ||
97 | + public String getMsg() { | ||
98 | + return msg; | ||
99 | + } | ||
100 | + | ||
101 | + } | ||
102 | + | ||
103 | + /** | ||
104 | + * Reserved for future use. | ||
105 | + * | ||
106 | + * Returns the configuration outcome (accept, deny etc.), and any configured | ||
107 | + * parameters to the caller, in response to a query for the configuration | ||
108 | + * associated with a link. | ||
109 | + */ | ||
110 | + public class LinkConfigStatus { | ||
111 | + private NetworkConfigState configState; | ||
112 | + private LinkConfig linkConfig; | ||
113 | + private String msg; | ||
114 | + | ||
115 | + LinkConfigStatus(NetworkConfigState configState, | ||
116 | + LinkConfig linkConfig, String msg) { | ||
117 | + this.configState = configState; | ||
118 | + this.linkConfig = linkConfig; | ||
119 | + this.msg = msg; | ||
120 | + } | ||
121 | + | ||
122 | + LinkConfigStatus(NetworkConfigState configState, | ||
123 | + LinkConfig linkConfig) { | ||
124 | + this.configState = configState; | ||
125 | + this.linkConfig = linkConfig; | ||
126 | + this.msg = ""; | ||
127 | + } | ||
128 | + | ||
129 | + /** | ||
130 | + * Returns the configuration state for the link. | ||
131 | + * | ||
132 | + * @return non-null NetworkConfigState | ||
133 | + */ | ||
134 | + public NetworkConfigState getConfigState() { | ||
135 | + return configState; | ||
136 | + } | ||
137 | + | ||
138 | + /** | ||
139 | + * Returns the link configuration, which may be null if no configuration | ||
140 | + * exists, or if the configuration state disallows the link. | ||
141 | + * | ||
142 | + * @return SwitchConfig, the switch configuration, or null | ||
143 | + */ | ||
144 | + public LinkConfig getLinkConfig() { | ||
145 | + return linkConfig; | ||
146 | + } | ||
147 | + | ||
148 | + /** | ||
149 | + * User readable string typically used to specify the reason why a link | ||
150 | + * is being disallowed. | ||
151 | + * | ||
152 | + * @return msg A non-null but possibly empty String | ||
153 | + */ | ||
154 | + public String getMsg() { | ||
155 | + return msg; | ||
156 | + } | ||
157 | + | ||
158 | + } | ||
159 | + | ||
160 | + /** | ||
161 | + * Checks the switch configuration (if any) associated with the 'dpid'. | ||
162 | + * Determines if the switch should be allowed or denied according to | ||
163 | + * configuration rules. | ||
164 | + * | ||
165 | + * The method always returns a non-null SwitchConfigStatus. The enclosed | ||
166 | + * ConfigState contains the result of the check. The enclosed SwitchConfig | ||
167 | + * may or may not be null, depending on the outcome of the check. | ||
168 | + * | ||
169 | + * @param dpid device id of the switch to be queried | ||
170 | + * @return SwitchConfigStatus with outcome of check and associated config. | ||
171 | + */ | ||
172 | + public SwitchConfigStatus checkSwitchConfig(DeviceId dpid); | ||
173 | + | ||
174 | + /** | ||
175 | + * Reserved for future use. | ||
176 | + * | ||
177 | + * Checks the link configuration (if any) associated with the 'link'. | ||
178 | + * Determines if the link should be allowed or denied according to | ||
179 | + * configuration rules. Note that the 'link' is a unidirectional link which | ||
180 | + * checked against configuration that is typically defined for a | ||
181 | + * bidirectional link. The caller may make a second call if it wishes to | ||
182 | + * check the 'reverse' direction. | ||
183 | + * | ||
184 | + * Also note that the configuration may not specify ports for a given | ||
185 | + * bidirectional link. In such cases, the configuration applies to all links | ||
186 | + * between the two switches. This method will check the given 'link' against | ||
187 | + * such configuration. | ||
188 | + | ||
189 | + * The method always returns a non-null LinkConfigStatus. The enclosed | ||
190 | + * ConfigState contains the result of the check. The enclosed LinkConfig may | ||
191 | + * or may not be null, depending on the outcome of the check. | ||
192 | + * | ||
193 | + * @param linkTuple unidirectional link to be queried | ||
194 | + * @return LinkConfigStatus with outcome of check and associated config. | ||
195 | + */ | ||
196 | + public LinkConfigStatus checkLinkConfig(Link linkTuple); | ||
197 | + | ||
198 | + /** | ||
199 | + * Retrieves a list of switches that have been configured, and have been | ||
200 | + * determined to be 'allowed' in the network, according to configuration | ||
201 | + * rules. | ||
202 | + * | ||
203 | + * Note that it is possible that there are other switches that are allowed | ||
204 | + * in the network that have NOT been configured. Such switches will not be a | ||
205 | + * part of the returned list. | ||
206 | + * | ||
207 | + * Also note that it is possible that some switches will not be discovered | ||
208 | + * and the only way the controller can know about these switches is via | ||
209 | + * configuration. Such switches will be included in this list. It is up to | ||
210 | + * the caller to determine which SwitchConfig applies to non-discovered | ||
211 | + * switches. | ||
212 | + * | ||
213 | + * @return a non-null List of SwitchConfig which may be empty | ||
214 | + */ | ||
215 | + public List<SwitchConfig> getConfiguredAllowedSwitches(); | ||
216 | + | ||
217 | + /** | ||
218 | + * Reserved for future use. | ||
219 | + * | ||
220 | + * Retrieves a list of links that have been configured, and have been | ||
221 | + * determined to be 'allowed' in the network, according to configuration | ||
222 | + * rules. | ||
223 | + * | ||
224 | + * Note that it is possible that there are other links that are allowed in | ||
225 | + * the network that have NOT been configured. Such links will not be a part | ||
226 | + * of the returned list. | ||
227 | + * | ||
228 | + * Also note that it is possible that some links will not be discovered and | ||
229 | + * the only way the controller can know about these links is via | ||
230 | + * configuration. Such links will be included in this list. It is up to the | ||
231 | + * caller to determine which LinkConfig applies to non-discovered links. | ||
232 | + * | ||
233 | + * In addition, note that the LinkConfig applies to the configured | ||
234 | + * bi-directional link, which may or may not have declared ports. The | ||
235 | + * associated unidirectional LinkTuple can be retrieved from the | ||
236 | + * getLinkTupleList() method in the LinkConfig object. | ||
237 | + * | ||
238 | + * @return a non-null List of LinkConfig which may be empty | ||
239 | + */ | ||
240 | + public List<LinkConfig> getConfiguredAllowedLinks(); | ||
241 | + | ||
242 | + /** | ||
243 | + * Retrieves the Dpid associated with a 'name' for a configured switch | ||
244 | + * object. This method does not check of the switches are 'allowed' by | ||
245 | + * config. | ||
246 | + * | ||
247 | + * @param name device name | ||
248 | + * @return the Dpid corresponding to a given 'name', or null if no | ||
249 | + * configured switch was found for the given 'name'. | ||
250 | + */ | ||
251 | + public DeviceId getDpidForName(String name); | ||
252 | + | ||
253 | +} |
apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/PktLinkConfig.java
0 → 100644
1 | +package org.onosproject.segmentrouting.config; | ||
2 | + | ||
3 | +import java.util.List; | ||
4 | +import java.util.Map.Entry; | ||
5 | +import java.util.Set; | ||
6 | +import java.util.concurrent.ConcurrentHashMap; | ||
7 | + | ||
8 | +import org.onosproject.net.Link; | ||
9 | +import org.onosproject.segmentrouting.config.NetworkConfig.LinkConfig; | ||
10 | +import org.slf4j.Logger; | ||
11 | +import org.slf4j.LoggerFactory; | ||
12 | + | ||
13 | +import com.fasterxml.jackson.databind.JsonNode; | ||
14 | + | ||
15 | +/** | ||
16 | + * Reserved for future use. | ||
17 | + * Configuration for a link between two packet-switches. | ||
18 | + */ | ||
19 | +public class PktLinkConfig extends LinkConfig { | ||
20 | + protected static final Logger log = LoggerFactory | ||
21 | + .getLogger(PktLinkConfig.class); | ||
22 | + private int port1; | ||
23 | + private int port2; | ||
24 | + private String nodeName1; | ||
25 | + private String nodeName2; | ||
26 | + private List<Link> linkTupleList; | ||
27 | + | ||
28 | + public PktLinkConfig(LinkConfig lkc) { | ||
29 | + nodeDpid1 = lkc.getNodeDpid1(); | ||
30 | + nodeDpid2 = lkc.getNodeDpid2(); | ||
31 | + dpid1 = lkc.getDpid1(); | ||
32 | + dpid2 = lkc.getDpid2(); | ||
33 | + type = lkc.getType(); | ||
34 | + allowed = lkc.isAllowed(); | ||
35 | + params = lkc.getParams(); | ||
36 | + publishAttributes = new ConcurrentHashMap<String, String>(); | ||
37 | + parseParams(); | ||
38 | + validateParams(); | ||
39 | + setPublishAttributes(); | ||
40 | + } | ||
41 | + | ||
42 | + // ******************** | ||
43 | + // Packet Link Configuration | ||
44 | + // ******************** | ||
45 | + | ||
46 | + public int getPort1() { | ||
47 | + return port1; | ||
48 | + } | ||
49 | + | ||
50 | + public void setPort1(int port1) { | ||
51 | + this.port1 = port1; | ||
52 | + } | ||
53 | + | ||
54 | + public int getPort2() { | ||
55 | + return port2; | ||
56 | + } | ||
57 | + | ||
58 | + public void setPort2(int port2) { | ||
59 | + this.port2 = port2; | ||
60 | + } | ||
61 | + | ||
62 | + public String getNodeName1() { | ||
63 | + return nodeName1; | ||
64 | + } | ||
65 | + | ||
66 | + public void setNodeName1(String nodeName1) { | ||
67 | + this.nodeName1 = nodeName1; | ||
68 | + } | ||
69 | + | ||
70 | + public String getNodeName2() { | ||
71 | + return nodeName2; | ||
72 | + } | ||
73 | + | ||
74 | + public void setNodeName2(String nodeName2) { | ||
75 | + this.nodeName2 = nodeName2; | ||
76 | + } | ||
77 | + | ||
78 | + /** | ||
79 | + * Returns the two unidirectional links corresponding to the packet-link | ||
80 | + * configuration. It is possible that the ports in the LinkTuple have | ||
81 | + * portnumber '0', implying that the configuration applies to all links | ||
82 | + * between the two switches. | ||
83 | + * | ||
84 | + * @return a list of LinkTuple with exactly 2 unidirectional links | ||
85 | + */ | ||
86 | + public List<Link> getLinkTupleList() { | ||
87 | + return linkTupleList; | ||
88 | + } | ||
89 | + | ||
90 | + private void setPublishAttributes() { | ||
91 | + | ||
92 | + } | ||
93 | + | ||
94 | + private void parseParams() { | ||
95 | + if (params == null) { | ||
96 | + throw new PktLinkParamsNotSpecified(nodeDpid1, nodeDpid2); | ||
97 | + } | ||
98 | + Set<Entry<String, JsonNode>> m = params.entrySet(); | ||
99 | + for (Entry<String, JsonNode> e : m) { | ||
100 | + String key = e.getKey(); | ||
101 | + JsonNode j = e.getValue(); | ||
102 | + if (key.equals("nodeName1")) { | ||
103 | + setNodeName1(j.asText()); | ||
104 | + } else if (key.equals("nodeName2")) { | ||
105 | + setNodeName2(j.asText()); | ||
106 | + } else if (key.equals("port1")) { | ||
107 | + setPort1(j.asInt()); | ||
108 | + } else if (key.equals("port2")) { | ||
109 | + setPort2(j.asInt()); | ||
110 | + } else { | ||
111 | + throw new UnknownPktLinkConfig(key, nodeDpid1, nodeDpid2); | ||
112 | + } | ||
113 | + } | ||
114 | + } | ||
115 | + | ||
116 | + private void validateParams() { | ||
117 | + // TODO - wrong-names, duplicate links, | ||
118 | + // duplicate use of port, is switch-allowed for which link is allowed? | ||
119 | + // valid port numbers | ||
120 | + } | ||
121 | + | ||
122 | + public static class PktLinkParamsNotSpecified extends RuntimeException { | ||
123 | + private static final long serialVersionUID = 6247582323691265513L; | ||
124 | + | ||
125 | + public PktLinkParamsNotSpecified(String dpidA, String dpidB) { | ||
126 | + super(); | ||
127 | + log.error("Params required for packet link - not specified " | ||
128 | + + "for link between switch1:{} and switch2:{}", | ||
129 | + dpidA, dpidB); | ||
130 | + } | ||
131 | + } | ||
132 | + | ||
133 | + public static class UnknownPktLinkConfig extends RuntimeException { | ||
134 | + private static final long serialVersionUID = -5750132094884129179L; | ||
135 | + | ||
136 | + public UnknownPktLinkConfig(String key, String dpidA, String dpidB) { | ||
137 | + super(); | ||
138 | + log.error("Unknown packet-link config {} for link between" | ||
139 | + + " dpid1: {} and dpid2: {}", key, | ||
140 | + dpidA, dpidB); | ||
141 | + } | ||
142 | + } | ||
143 | + | ||
144 | +} |
apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/SegmentRouterConfig.java
0 → 100644
This diff is collapsed. Click to expand it.
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.grouphandler; | 16 | +package org.onosproject.segmentrouting.grouphandler; |
17 | 17 | ||
18 | import java.util.Arrays; | 18 | import java.util.Arrays; |
19 | import java.util.HashSet; | 19 | import java.util.HashSet; | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.grouphandler; | 16 | +package org.onosproject.segmentrouting.grouphandler; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | import static org.slf4j.LoggerFactory.getLogger; | 19 | import static org.slf4j.LoggerFactory.getLogger; | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.grouphandler; | 16 | +package org.onosproject.segmentrouting.grouphandler; |
17 | 17 | ||
18 | import java.util.Arrays; | 18 | import java.util.Arrays; |
19 | import java.util.HashSet; | 19 | import java.util.HashSet; | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.grouphandler; | 16 | +package org.onosproject.segmentrouting.grouphandler; |
17 | 17 | ||
18 | import java.util.List; | 18 | import java.util.List; |
19 | 19 | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.grouphandler; | 16 | +package org.onosproject.segmentrouting.grouphandler; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | 19 | ... | ... |
... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | -package org.onosproject.grouphandler; | 17 | +package org.onosproject.segmentrouting.grouphandler; |
18 | 18 | ||
19 | import static com.google.common.base.Preconditions.checkNotNull; | 19 | import static com.google.common.base.Preconditions.checkNotNull; |
20 | 20 | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.grouphandler; | 16 | +package org.onosproject.segmentrouting.grouphandler; |
17 | 17 | ||
18 | import static org.slf4j.LoggerFactory.getLogger; | 18 | import static org.slf4j.LoggerFactory.getLogger; |
19 | 19 | ||
... | @@ -26,7 +26,7 @@ import java.util.List; | ... | @@ -26,7 +26,7 @@ import java.util.List; |
26 | import org.onlab.packet.MplsLabel; | 26 | import org.onlab.packet.MplsLabel; |
27 | import org.onosproject.core.ApplicationId; | 27 | import org.onosproject.core.ApplicationId; |
28 | import org.onosproject.core.GroupId; | 28 | import org.onosproject.core.GroupId; |
29 | -import org.onosproject.grouphandler.GroupBucketIdentifier.BucketOutputType; | 29 | +import org.onosproject.segmentrouting.grouphandler.GroupBucketIdentifier.BucketOutputType; |
30 | import org.onosproject.net.DeviceId; | 30 | import org.onosproject.net.DeviceId; |
31 | import org.onosproject.net.PortNumber; | 31 | import org.onosproject.net.PortNumber; |
32 | import org.onosproject.net.flow.DefaultTrafficTreatment; | 32 | import org.onosproject.net.flow.DefaultTrafficTreatment; | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.grouphandler; | 16 | +package org.onosproject.segmentrouting.grouphandler; |
17 | 17 | ||
18 | import java.util.List; | 18 | import java.util.List; |
19 | 19 | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | -package org.onosproject.grouphandler; | 16 | +package org.onosproject.segmentrouting.grouphandler; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | 19 | ... | ... |
1 | +{ | ||
2 | + "comment": " Multilayer topology description and configuration", | ||
3 | + "restrictSwitches": true, | ||
4 | + "restrictLinks": true, | ||
5 | + | ||
6 | + "switchConfig": | ||
7 | + [ | ||
8 | + { "nodeDpid" : "of:0000000000000001", "name": "Dallas-R1", "type": "Router_SR", "allowed": true, | ||
9 | + "latitude": 80.80, "longitude": 90.10, | ||
10 | + "params": { "routerIp": "192.168.0.1/32", | ||
11 | + "routerMac": "00:00:01:01:01:80", | ||
12 | + "nodeSid": 101, | ||
13 | + "isEdgeRouter" : true, | ||
14 | + "adjacencySids": [ | ||
15 | + { "ports": [ 4, 5 ], "adjSid": 10234 }, | ||
16 | + { "ports": [ 6, 7 ], "adjSid": 29019 } | ||
17 | + ], | ||
18 | + "subnets": [ | ||
19 | + { "portNo": 1, "subnetIp": "10.0.1.128/24" } | ||
20 | + ] | ||
21 | + } | ||
22 | + }, | ||
23 | + | ||
24 | + { "nodeDpid": "of:0000000000000002", "name": "Dallas-R2", "type": "Router_SR", "allowed": true, | ||
25 | + "latitude": 80.80, "longitude": 90.10, | ||
26 | + "params": { "routerIp": "192.168.0.2/32", | ||
27 | + "routerMac": "00:00:02:02:02:80", | ||
28 | + "nodeSid": 102, | ||
29 | + "isEdgeRouter" : false, | ||
30 | + "adjacencySids": [ | ||
31 | + { "ports": [ 1, 2 ], "adjSid": 12453 }, | ||
32 | + { "ports": [ 2, 3 ], "adjSid": 23333 }, | ||
33 | + { "ports": [ 3, 1 ], "adjSid": 22233 } | ||
34 | + ] | ||
35 | + } | ||
36 | + }, | ||
37 | + | ||
38 | + { "nodeDpid": "of:0000000000000003", "name": "Dallas-R3", "type": "Router_SR", "allowed": true, | ||
39 | + "latitude": 80.80, "longitude": 90.10, | ||
40 | + "params": { "routerIp": "192.168.0.3/32", | ||
41 | + "routerMac": "00:00:03:03:03:80", | ||
42 | + "nodeSid": 103, | ||
43 | + "isEdgeRouter" : false | ||
44 | + } | ||
45 | + }, | ||
46 | + | ||
47 | + { "nodeDpid": "of:0000000000000004", "name": "Dallas-R4", "type": "Router_SR", "allowed": true, | ||
48 | + "latitude": 80.80, "longitude": 90.10, | ||
49 | + "params": { "routerIp": "192.168.0.4/32", | ||
50 | + "routerMac": "00:00:04:04:04:80", | ||
51 | + "nodeSid": 104, | ||
52 | + "isEdgeRouter" : false | ||
53 | + } | ||
54 | + }, | ||
55 | + | ||
56 | + { "nodeDpid": "of:0000000000000005", "name": "Dallas-R5", "type": "Router_SR", "allowed": true, | ||
57 | + "latitude": 80.80, "longitude": 90.10, | ||
58 | + "params": { "routerIp": "192.168.0.5/32", | ||
59 | + "routerMac": "00:00:05:05:05:80", | ||
60 | + "nodeSid": 105, | ||
61 | + "isEdgeRouter" : false | ||
62 | + } | ||
63 | + }, | ||
64 | + | ||
65 | + { "nodeDpid": "of:0000000000000006", "name": "Dallas-R6", "type": "Router_SR", "allowed": true, | ||
66 | + "latitude": 80.80, "longitude": 90.10, | ||
67 | + "params": { "routerIp": "192.168.0.6/32", | ||
68 | + "routerMac": "00:00:07:07:07:80", | ||
69 | + "nodeSid": 106, | ||
70 | + "isEdgeRouter" : true, | ||
71 | + "subnets": [ | ||
72 | + { "portNo": 1, "subnetIp": "7.7.7.128/24" } | ||
73 | + ] | ||
74 | + } | ||
75 | + } | ||
76 | + | ||
77 | + ] | ||
78 | +} |
-
Please register or login to post a comment