Remove old config classes from routing bundle.
Change-Id: Ifc8ff03674c1cfb9e3cde86b9994b8362744840d
Showing
8 changed files
with
44 additions
and
818 deletions
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | -package org.onosproject.routing.config; | ||
17 | - | ||
18 | -import com.fasterxml.jackson.annotation.JsonProperty; | ||
19 | -import com.google.common.base.MoreObjects; | ||
20 | -import org.onlab.packet.IpAddress; | ||
21 | -import org.onosproject.net.ConnectPoint; | ||
22 | -import org.onosproject.net.DeviceId; | ||
23 | -import org.onosproject.net.NetTools; | ||
24 | -import org.onosproject.net.PortNumber; | ||
25 | - | ||
26 | -import java.util.Objects; | ||
27 | - | ||
28 | -/** | ||
29 | - * Configuration details for a BGP peer. | ||
30 | - */ | ||
31 | -public class BgpPeer { | ||
32 | - private final ConnectPoint connectPoint; | ||
33 | - private final IpAddress ipAddress; | ||
34 | - | ||
35 | - /** | ||
36 | - * Creates a new BgpPeer. | ||
37 | - * | ||
38 | - * @param dpid the DPID of the switch the peer is attached at, as a String | ||
39 | - * @param port the port the peer is attached at | ||
40 | - * @param ipAddress the IP address of the peer as a String | ||
41 | - */ | ||
42 | - public BgpPeer(@JsonProperty("attachmentDpid") String dpid, | ||
43 | - @JsonProperty("attachmentPort") long port, | ||
44 | - @JsonProperty("ipAddress") String ipAddress) { | ||
45 | - this.connectPoint = new ConnectPoint( | ||
46 | - DeviceId.deviceId(NetTools.dpidToUri(dpid)), | ||
47 | - PortNumber.portNumber(port)); | ||
48 | - this.ipAddress = IpAddress.valueOf(ipAddress); | ||
49 | - } | ||
50 | - | ||
51 | - /** | ||
52 | - * Gets the connection point of the peer. | ||
53 | - * | ||
54 | - * @return the connection point | ||
55 | - */ | ||
56 | - public ConnectPoint connectPoint() { | ||
57 | - return connectPoint; | ||
58 | - } | ||
59 | - | ||
60 | - /** | ||
61 | - * Gets the IP address of the peer. | ||
62 | - * | ||
63 | - * @return the IP address | ||
64 | - */ | ||
65 | - public IpAddress ipAddress() { | ||
66 | - return ipAddress; | ||
67 | - } | ||
68 | - | ||
69 | - @Override | ||
70 | - public int hashCode() { | ||
71 | - return Objects.hash(connectPoint, ipAddress); | ||
72 | - } | ||
73 | - | ||
74 | - @Override | ||
75 | - public boolean equals(Object obj) { | ||
76 | - if (obj == this) { | ||
77 | - return true; | ||
78 | - } | ||
79 | - | ||
80 | - if (!(obj instanceof BgpPeer)) { | ||
81 | - return false; | ||
82 | - } | ||
83 | - | ||
84 | - BgpPeer that = (BgpPeer) obj; | ||
85 | - return Objects.equals(this.connectPoint, that.connectPoint) | ||
86 | - && Objects.equals(this.ipAddress, that.ipAddress); | ||
87 | - } | ||
88 | - | ||
89 | - @Override | ||
90 | - public String toString() { | ||
91 | - return MoreObjects.toStringHelper(getClass()) | ||
92 | - .add("connectPoint", connectPoint) | ||
93 | - .add("ipAddress", ipAddress) | ||
94 | - .toString(); | ||
95 | - } | ||
96 | -} |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | -package org.onosproject.routing.config; | ||
17 | - | ||
18 | -import com.fasterxml.jackson.annotation.JsonCreator; | ||
19 | -import com.fasterxml.jackson.annotation.JsonProperty; | ||
20 | -import com.google.common.base.MoreObjects; | ||
21 | -import org.onlab.packet.MacAddress; | ||
22 | -import org.onosproject.net.ConnectPoint; | ||
23 | -import org.onosproject.net.DeviceId; | ||
24 | -import org.onosproject.net.NetTools; | ||
25 | -import org.onosproject.net.PortNumber; | ||
26 | - | ||
27 | -import java.util.List; | ||
28 | -import java.util.Objects; | ||
29 | - | ||
30 | -/** | ||
31 | - * Represents a BGP daemon in SDN network. | ||
32 | - * <p> | ||
33 | - * Each BGP speaker has a attachment point, which includes a switch DPID and a | ||
34 | - * switch port. Each BGP speaker has one MAC address and several IP addresses, | ||
35 | - * which are used to peer with BGP peers outside the SDN network. For each | ||
36 | - * peer outside the SDN network, we configure a different IP address to BGP | ||
37 | - * speaker inside the SDN network. | ||
38 | - * </p> | ||
39 | - * <p> | ||
40 | - * Each BGP speaker has a name, which is a unique identifying String that is | ||
41 | - * used to reference this speaker in the configuration. | ||
42 | - * </p> | ||
43 | - */ | ||
44 | -public class BgpSpeaker { | ||
45 | - private final String name; | ||
46 | - private final ConnectPoint connectPoint; | ||
47 | - private final MacAddress macAddress; | ||
48 | - private List<InterfaceAddress> interfaceAddresses; | ||
49 | - | ||
50 | - /** | ||
51 | - * Class constructor used by the JSON library to create an object. | ||
52 | - * | ||
53 | - * @param name the name of the BGP speaker inside SDN network | ||
54 | - * @param attachmentDpid the DPID where the BGP speaker is attached to | ||
55 | - * @param attachmentPort the port where the BGP speaker is attached to | ||
56 | - * @param macAddress the MAC address of the BGP speaker | ||
57 | - */ | ||
58 | - @JsonCreator | ||
59 | - public BgpSpeaker(@JsonProperty("name") String name, | ||
60 | - @JsonProperty("attachmentDpid") String attachmentDpid, | ||
61 | - @JsonProperty("attachmentPort") long attachmentPort, | ||
62 | - @JsonProperty("macAddress") String macAddress) { | ||
63 | - | ||
64 | - this.name = name; | ||
65 | - this.macAddress = MacAddress.valueOf(macAddress); | ||
66 | - this.connectPoint = new ConnectPoint( | ||
67 | - DeviceId.deviceId(NetTools.dpidToUri(attachmentDpid)), | ||
68 | - PortNumber.portNumber(attachmentPort)); | ||
69 | - } | ||
70 | - | ||
71 | - /** | ||
72 | - * Sets the addresses we configured for the BGP speaker on all virtual | ||
73 | - * {@link Interface}s. | ||
74 | - * | ||
75 | - * @param interfaceAddresses a list of IP addresses of the BGP speaker | ||
76 | - * configured on all virtual interfaces | ||
77 | - */ | ||
78 | - @JsonProperty("interfaceAddresses") | ||
79 | - public void setInterfaceAddresses( | ||
80 | - List<InterfaceAddress> interfaceAddresses) { | ||
81 | - this.interfaceAddresses = interfaceAddresses; | ||
82 | - } | ||
83 | - | ||
84 | - /** | ||
85 | - * Gets the BGP speaker name. | ||
86 | - * | ||
87 | - * @return the BGP speaker name | ||
88 | - */ | ||
89 | - public String name() { | ||
90 | - return name; | ||
91 | - } | ||
92 | - | ||
93 | - /** | ||
94 | - * Gets the connect point where the BGP speaker is attached. | ||
95 | - * | ||
96 | - * @return the connect point | ||
97 | - */ | ||
98 | - public ConnectPoint connectPoint() { | ||
99 | - return connectPoint; | ||
100 | - } | ||
101 | - | ||
102 | - /** | ||
103 | - * Gets the MAC address of the BGP speaker. | ||
104 | - * | ||
105 | - * @return the MAC address | ||
106 | - */ | ||
107 | - public MacAddress macAddress() { | ||
108 | - return macAddress; | ||
109 | - } | ||
110 | - | ||
111 | - /** | ||
112 | - * Gets all IP addresses configured on all {@link Interface}s of the | ||
113 | - * BGP speaker. | ||
114 | - * | ||
115 | - * @return a list of IP addresses of the BGP speaker configured on all | ||
116 | - * virtual interfaces | ||
117 | - */ | ||
118 | - public List<InterfaceAddress> interfaceAddresses() { | ||
119 | - return interfaceAddresses; | ||
120 | - } | ||
121 | - | ||
122 | - @Override | ||
123 | - public boolean equals(Object other) { | ||
124 | - if (!(other instanceof BgpSpeaker)) { | ||
125 | - return false; | ||
126 | - } | ||
127 | - | ||
128 | - BgpSpeaker otherBgpSpeaker = (BgpSpeaker) other; | ||
129 | - | ||
130 | - return name.equals(otherBgpSpeaker.name) && | ||
131 | - connectPoint.equals( | ||
132 | - otherBgpSpeaker.connectPoint) && | ||
133 | - macAddress.equals(otherBgpSpeaker.macAddress) && | ||
134 | - interfaceAddresses.equals(otherBgpSpeaker.interfaceAddresses); | ||
135 | - } | ||
136 | - | ||
137 | - @Override | ||
138 | - public int hashCode() { | ||
139 | - return Objects.hash(name, connectPoint, macAddress, | ||
140 | - interfaceAddresses); | ||
141 | - | ||
142 | - } | ||
143 | - | ||
144 | - @Override | ||
145 | - public String toString() { | ||
146 | - return MoreObjects.toStringHelper(getClass()) | ||
147 | - .add("speakerName", name) | ||
148 | - .add("connectPoint", connectPoint) | ||
149 | - .add("macAddress", macAddress) | ||
150 | - .add("interfaceAddresses", interfaceAddresses) | ||
151 | - .toString(); | ||
152 | - } | ||
153 | -} |
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | -package org.onosproject.routing.config; | ||
17 | - | ||
18 | -import com.google.common.base.MoreObjects; | ||
19 | -import com.google.common.collect.Sets; | ||
20 | -import org.onlab.packet.MacAddress; | ||
21 | -import org.onlab.packet.VlanId; | ||
22 | -import org.onosproject.net.ConnectPoint; | ||
23 | -import org.onosproject.net.host.InterfaceIpAddress; | ||
24 | - | ||
25 | -import java.util.Objects; | ||
26 | -import java.util.Set; | ||
27 | - | ||
28 | -/** | ||
29 | - * An Interface is a set of addresses that are logically mapped to a switch | ||
30 | - * port in the network. | ||
31 | - */ | ||
32 | -public class Interface { | ||
33 | - private final ConnectPoint connectPoint; | ||
34 | - private final Set<InterfaceIpAddress> ipAddresses; | ||
35 | - private final MacAddress macAddress; | ||
36 | - private final VlanId vlan; | ||
37 | - | ||
38 | - /** | ||
39 | - * Creates an Interface based on a connection point, a set of interface | ||
40 | - * IP addresses, and a MAC address. | ||
41 | - * | ||
42 | - * @param connectPoint the connect point this interface is mapped to | ||
43 | - * @param ipAddresses the IP addresses for the interface | ||
44 | - * @param macAddress the MAC address of the interface | ||
45 | - * @param vlan VLAN identifier | ||
46 | - */ | ||
47 | - public Interface(ConnectPoint connectPoint, | ||
48 | - Set<InterfaceIpAddress> ipAddresses, | ||
49 | - MacAddress macAddress, VlanId vlan) { | ||
50 | - this.connectPoint = connectPoint; | ||
51 | - this.ipAddresses = Sets.newHashSet(ipAddresses); | ||
52 | - this.macAddress = macAddress; | ||
53 | - this.vlan = vlan; | ||
54 | - } | ||
55 | - | ||
56 | - /** | ||
57 | - * Retrieves the connection point that this interface maps to. | ||
58 | - * | ||
59 | - * @return the connection point | ||
60 | - */ | ||
61 | - public ConnectPoint connectPoint() { | ||
62 | - return connectPoint; | ||
63 | - } | ||
64 | - | ||
65 | - /** | ||
66 | - * Retrieves the set of IP addresses that are assigned to the interface. | ||
67 | - * | ||
68 | - * @return the set of interface IP addresses | ||
69 | - */ | ||
70 | - public Set<InterfaceIpAddress> ipAddresses() { | ||
71 | - return ipAddresses; | ||
72 | - } | ||
73 | - | ||
74 | - /** | ||
75 | - * Retrieves the MAC address that is assigned to the interface. | ||
76 | - * | ||
77 | - * @return the MAC address | ||
78 | - */ | ||
79 | - public MacAddress mac() { | ||
80 | - return macAddress; | ||
81 | - } | ||
82 | - | ||
83 | - /** | ||
84 | - * Retrieves the VLAN ID that is assigned to the interface. | ||
85 | - * | ||
86 | - * @return the VLAN ID | ||
87 | - */ | ||
88 | - public VlanId vlan() { | ||
89 | - return vlan; | ||
90 | - } | ||
91 | - | ||
92 | - @Override | ||
93 | - public boolean equals(Object other) { | ||
94 | - if (!(other instanceof Interface)) { | ||
95 | - return false; | ||
96 | - } | ||
97 | - | ||
98 | - Interface otherInterface = (Interface) other; | ||
99 | - | ||
100 | - return connectPoint.equals(otherInterface.connectPoint) && | ||
101 | - ipAddresses.equals(otherInterface.ipAddresses) && | ||
102 | - macAddress.equals(otherInterface.macAddress) && | ||
103 | - vlan.equals(otherInterface.vlan); | ||
104 | - } | ||
105 | - | ||
106 | - @Override | ||
107 | - public int hashCode() { | ||
108 | - return Objects.hash(connectPoint, ipAddresses, macAddress, vlan); | ||
109 | - } | ||
110 | - | ||
111 | - @Override | ||
112 | - public String toString() { | ||
113 | - return MoreObjects.toStringHelper(getClass()) | ||
114 | - .add("connectPoint", connectPoint) | ||
115 | - .add("ipAddresses", ipAddresses) | ||
116 | - .add("macAddress", macAddress) | ||
117 | - .add("vlan", vlan) | ||
118 | - .toString(); | ||
119 | - } | ||
120 | -} |
apps/routing-api/src/main/java/org/onosproject/routing/config/InterfaceAddress.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | -package org.onosproject.routing.config; | ||
17 | - | ||
18 | -import com.fasterxml.jackson.annotation.JsonProperty; | ||
19 | -import com.google.common.base.MoreObjects; | ||
20 | -import org.onlab.packet.IpAddress; | ||
21 | -import org.onosproject.net.ConnectPoint; | ||
22 | -import org.onosproject.net.DeviceId; | ||
23 | -import org.onosproject.net.NetTools; | ||
24 | -import org.onosproject.net.PortNumber; | ||
25 | - | ||
26 | -import java.util.Objects; | ||
27 | - | ||
28 | -/** | ||
29 | - * Represents an address of a {@link BgpSpeaker} configured on an | ||
30 | - * {@link Interface}. | ||
31 | - * <p> | ||
32 | - * Each InterfaceAddress includes the interface name and an IP address. | ||
33 | - * </p> | ||
34 | - */ | ||
35 | -public class InterfaceAddress { | ||
36 | - private final ConnectPoint connectPoint; | ||
37 | - private final IpAddress ipAddress; | ||
38 | - | ||
39 | - /** | ||
40 | - * Creates an InterfaceAddress object. | ||
41 | - * | ||
42 | - * @param dpid the DPID of the interface as a String | ||
43 | - * @param port the port of the interface | ||
44 | - * @param ipAddress the IP address of a {@link BgpSpeaker} configured on | ||
45 | - * the interface | ||
46 | - */ | ||
47 | - public InterfaceAddress(@JsonProperty("interfaceDpid") String dpid, | ||
48 | - @JsonProperty("interfacePort") int port, | ||
49 | - @JsonProperty("ipAddress") String ipAddress) { | ||
50 | - this.connectPoint = new ConnectPoint( | ||
51 | - DeviceId.deviceId(NetTools.dpidToUri(dpid)), | ||
52 | - PortNumber.portNumber(port)); | ||
53 | - this.ipAddress = IpAddress.valueOf(ipAddress); | ||
54 | - } | ||
55 | - | ||
56 | - /** | ||
57 | - * Gets the connection point of the peer. | ||
58 | - * | ||
59 | - * @return the connection point | ||
60 | - */ | ||
61 | - public ConnectPoint connectPoint() { | ||
62 | - return connectPoint; | ||
63 | - } | ||
64 | - | ||
65 | - /** | ||
66 | - * Gets the IP address of a BGP speaker configured on an {@link Interface}. | ||
67 | - * | ||
68 | - * @return the IP address | ||
69 | - */ | ||
70 | - public IpAddress ipAddress() { | ||
71 | - return ipAddress; | ||
72 | - } | ||
73 | - | ||
74 | - @Override | ||
75 | - public int hashCode() { | ||
76 | - return Objects.hash(connectPoint, ipAddress); | ||
77 | - } | ||
78 | - | ||
79 | - @Override | ||
80 | - public boolean equals(Object obj) { | ||
81 | - if (obj == this) { | ||
82 | - return true; | ||
83 | - } | ||
84 | - | ||
85 | - if (!(obj instanceof InterfaceAddress)) { | ||
86 | - return false; | ||
87 | - } | ||
88 | - | ||
89 | - InterfaceAddress that = (InterfaceAddress) obj; | ||
90 | - return Objects.equals(this.connectPoint, that.connectPoint) | ||
91 | - && Objects.equals(this.ipAddress, that.ipAddress); | ||
92 | - } | ||
93 | - | ||
94 | - @Override | ||
95 | - public String toString() { | ||
96 | - return MoreObjects.toStringHelper(getClass()) | ||
97 | - .add("connectPoint", connectPoint) | ||
98 | - .add("ipAddress", ipAddress) | ||
99 | - .toString(); | ||
100 | - } | ||
101 | -} |
apps/routing/src/main/java/org/onosproject/routing/config/impl/Configuration.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2015-present Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | -package org.onosproject.routing.config.impl; | ||
17 | - | ||
18 | -import com.fasterxml.jackson.annotation.JsonProperty; | ||
19 | - | ||
20 | -import org.onlab.packet.MacAddress; | ||
21 | -import org.onosproject.routing.config.BgpPeer; | ||
22 | -import org.onosproject.routing.config.BgpSpeaker; | ||
23 | -import org.onosproject.routing.config.LocalIpPrefixEntry; | ||
24 | - | ||
25 | -import java.util.Collections; | ||
26 | -import java.util.List; | ||
27 | - | ||
28 | -/** | ||
29 | - * Contains the configuration data for SDN-IP that has been read from a | ||
30 | - * JSON-formatted configuration file. | ||
31 | - */ | ||
32 | -public class Configuration { | ||
33 | - // We call the BGP routers in our SDN network the BGP speakers, and call | ||
34 | - // the BGP routers outside our SDN network the BGP peers. | ||
35 | - private List<BgpSpeaker> bgpSpeakers = Collections.emptyList(); | ||
36 | - private List<BgpPeer> peers = Collections.emptyList(); | ||
37 | - private MacAddress virtualGatewayMacAddress; | ||
38 | - | ||
39 | - // All IP prefixes from the configuration are local | ||
40 | - private List<LocalIpPrefixEntry> localIp4PrefixEntries = | ||
41 | - Collections.emptyList(); | ||
42 | - private List<LocalIpPrefixEntry> localIp6PrefixEntries = | ||
43 | - Collections.emptyList(); | ||
44 | - | ||
45 | - /** | ||
46 | - * Default constructor. | ||
47 | - */ | ||
48 | - public Configuration() { | ||
49 | - } | ||
50 | - | ||
51 | - /** | ||
52 | - * Gets a list of bgpSpeakers in the system, represented by | ||
53 | - * {@link BgpSpeaker} objects. | ||
54 | - * | ||
55 | - * @return the list of BGP speakers | ||
56 | - */ | ||
57 | - public List<BgpSpeaker> getBgpSpeakers() { | ||
58 | - return Collections.unmodifiableList(bgpSpeakers); | ||
59 | - } | ||
60 | - | ||
61 | - /** | ||
62 | - * Sets a list of bgpSpeakers in the system. | ||
63 | - * | ||
64 | - * @param bgpSpeakers the list of BGP speakers | ||
65 | - */ | ||
66 | - @JsonProperty("bgpSpeakers") | ||
67 | - public void setBgpSpeakers(List<BgpSpeaker> bgpSpeakers) { | ||
68 | - this.bgpSpeakers = bgpSpeakers; | ||
69 | - } | ||
70 | - | ||
71 | - /** | ||
72 | - * Gets a list of BGP peers we are configured to peer with. Peers are | ||
73 | - * represented by {@link BgpPeer} objects. | ||
74 | - * | ||
75 | - * @return the list of BGP peers | ||
76 | - */ | ||
77 | - public List<BgpPeer> getPeers() { | ||
78 | - return Collections.unmodifiableList(peers); | ||
79 | - } | ||
80 | - | ||
81 | - /** | ||
82 | - * Sets a list of BGP peers we configured to peer with. | ||
83 | - * | ||
84 | - * @param peers the list of BGP peers | ||
85 | - */ | ||
86 | - @JsonProperty("bgpPeers") | ||
87 | - public void setPeers(List<BgpPeer> peers) { | ||
88 | - this.peers = peers; | ||
89 | - } | ||
90 | - | ||
91 | - /** | ||
92 | - * Gets the MAC address we configured for virtual gateway | ||
93 | - * in SDN network. | ||
94 | - * | ||
95 | - * @return the MAC address of virtual gateway | ||
96 | - */ | ||
97 | - public MacAddress getVirtualGatewayMacAddress() { | ||
98 | - return virtualGatewayMacAddress; | ||
99 | - } | ||
100 | - | ||
101 | - /** | ||
102 | - * Sets the MAC address for virtual gateway in SDN network. | ||
103 | - * | ||
104 | - * @param virtualGatewayMacAddress the MAC address of virtual gateway | ||
105 | - */ | ||
106 | - @JsonProperty("virtualGatewayMacAddress") | ||
107 | - public void setVirtualGatewayMacAddress(MacAddress virtualGatewayMacAddress) { | ||
108 | - this.virtualGatewayMacAddress = virtualGatewayMacAddress; | ||
109 | - } | ||
110 | - | ||
111 | - /** | ||
112 | - * Gets a list of local IPv4 prefix entries configured for local | ||
113 | - * SDN network. | ||
114 | - * <p> | ||
115 | - * IP prefix entries are represented by {@link LocalIpPrefixEntry} | ||
116 | - * objects. | ||
117 | - * </p> | ||
118 | - * | ||
119 | - * @return the list of local IPv4 prefix entries | ||
120 | - */ | ||
121 | - public List<LocalIpPrefixEntry> getLocalIp4PrefixEntries() { | ||
122 | - return Collections.unmodifiableList(localIp4PrefixEntries); | ||
123 | - } | ||
124 | - | ||
125 | - /** | ||
126 | - * Sets a list of IPv4 prefix entries configured for local SDN network. | ||
127 | - * | ||
128 | - * @param ip4PrefixEntries the list of Ipv4 prefix entries | ||
129 | - */ | ||
130 | - @JsonProperty("ip4LocalPrefixes") | ||
131 | - public void setLocalIp4PrefixEntries(List<LocalIpPrefixEntry> ip4PrefixEntries) { | ||
132 | - this.localIp4PrefixEntries = ip4PrefixEntries; | ||
133 | - } | ||
134 | - | ||
135 | - /** | ||
136 | - * Gets a list of IPv6 prefix entries configured for local SDN network. | ||
137 | - * <p> | ||
138 | - * IP prefix entries are represented by {@link LocalIpPrefixEntry} | ||
139 | - * objects. | ||
140 | - * </p> | ||
141 | - * | ||
142 | - * @return the list of IPv6 prefix entries | ||
143 | - */ | ||
144 | - public List<LocalIpPrefixEntry> getLocalIp6PrefixEntries() { | ||
145 | - return Collections.unmodifiableList(localIp6PrefixEntries); | ||
146 | - } | ||
147 | - | ||
148 | - /** | ||
149 | - * Sets a list of IPv6 prefix entries configured for local SDN network. | ||
150 | - * | ||
151 | - * @param ip6PrefixEntries the list of Ipv6 prefix entries | ||
152 | - */ | ||
153 | - @JsonProperty("ip6LocalPrefixes") | ||
154 | - public void setLocalIp6PrefixEntries(List<LocalIpPrefixEntry> ip6PrefixEntries) { | ||
155 | - this.localIp6PrefixEntries = ip6PrefixEntries; | ||
156 | - } | ||
157 | - | ||
158 | -} |
... | @@ -58,7 +58,7 @@ import static org.onosproject.routing.RouteEntry.createBinaryString; | ... | @@ -58,7 +58,7 @@ import static org.onosproject.routing.RouteEntry.createBinaryString; |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * Implementation of RoutingConfigurationService which reads routing | 60 | * Implementation of RoutingConfigurationService which reads routing |
61 | - * configuration from a file. | 61 | + * configuration from the network configuration service. |
62 | */ | 62 | */ |
63 | @Component(immediate = true) | 63 | @Component(immediate = true) |
64 | @Service | 64 | @Service | ... | ... |
... | @@ -15,20 +15,14 @@ | ... | @@ -15,20 +15,14 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.routing.impl; | 16 | package org.onosproject.routing.impl; |
17 | 17 | ||
18 | -import com.google.common.collect.Lists; | ||
19 | -import com.google.common.collect.Sets; | ||
20 | import com.google.common.util.concurrent.MoreExecutors; | 18 | import com.google.common.util.concurrent.MoreExecutors; |
21 | import org.junit.Before; | 19 | import org.junit.Before; |
22 | import org.junit.Test; | 20 | import org.junit.Test; |
23 | -import org.onlab.junit.TestUtils; | ||
24 | -import org.onlab.junit.TestUtils.TestUtilsException; | ||
25 | import org.onlab.packet.Ethernet; | 21 | import org.onlab.packet.Ethernet; |
26 | -import org.onlab.packet.Ip4Address; | ||
27 | import org.onlab.packet.Ip4Prefix; | 22 | import org.onlab.packet.Ip4Prefix; |
28 | import org.onlab.packet.IpAddress; | 23 | import org.onlab.packet.IpAddress; |
29 | import org.onlab.packet.IpPrefix; | 24 | import org.onlab.packet.IpPrefix; |
30 | import org.onlab.packet.MacAddress; | 25 | import org.onlab.packet.MacAddress; |
31 | -import org.onlab.packet.VlanId; | ||
32 | import org.onosproject.TestApplicationId; | 26 | import org.onosproject.TestApplicationId; |
33 | import org.onosproject.cluster.ClusterServiceAdapter; | 27 | import org.onosproject.cluster.ClusterServiceAdapter; |
34 | import org.onosproject.cluster.ControllerNode; | 28 | import org.onosproject.cluster.ControllerNode; |
... | @@ -37,7 +31,6 @@ import org.onosproject.cluster.LeadershipServiceAdapter; | ... | @@ -37,7 +31,6 @@ import org.onosproject.cluster.LeadershipServiceAdapter; |
37 | import org.onosproject.cluster.NodeId; | 31 | import org.onosproject.cluster.NodeId; |
38 | import org.onosproject.core.ApplicationId; | 32 | import org.onosproject.core.ApplicationId; |
39 | import org.onosproject.core.CoreServiceAdapter; | 33 | import org.onosproject.core.CoreServiceAdapter; |
40 | -import org.onosproject.incubator.net.intf.Interface; | ||
41 | import org.onosproject.net.ConnectPoint; | 34 | import org.onosproject.net.ConnectPoint; |
42 | import org.onosproject.net.DeviceId; | 35 | import org.onosproject.net.DeviceId; |
43 | import org.onosproject.net.PortNumber; | 36 | import org.onosproject.net.PortNumber; |
... | @@ -45,19 +38,15 @@ import org.onosproject.net.flow.DefaultTrafficSelector; | ... | @@ -45,19 +38,15 @@ import org.onosproject.net.flow.DefaultTrafficSelector; |
45 | import org.onosproject.net.flow.DefaultTrafficTreatment; | 38 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
46 | import org.onosproject.net.flow.TrafficSelector; | 39 | import org.onosproject.net.flow.TrafficSelector; |
47 | import org.onosproject.net.flow.TrafficTreatment; | 40 | import org.onosproject.net.flow.TrafficTreatment; |
48 | -import org.onosproject.net.host.InterfaceIpAddress; | ||
49 | import org.onosproject.net.intent.AbstractIntentTest; | 41 | import org.onosproject.net.intent.AbstractIntentTest; |
50 | import org.onosproject.net.intent.Intent; | 42 | import org.onosproject.net.intent.Intent; |
51 | import org.onosproject.net.intent.IntentService; | 43 | import org.onosproject.net.intent.IntentService; |
52 | import org.onosproject.net.intent.IntentState; | 44 | import org.onosproject.net.intent.IntentState; |
53 | -import org.onosproject.net.intent.IntentUtils; | ||
54 | import org.onosproject.net.intent.Key; | 45 | import org.onosproject.net.intent.Key; |
55 | import org.onosproject.net.intent.MultiPointToSinglePointIntent; | 46 | import org.onosproject.net.intent.MultiPointToSinglePointIntent; |
56 | -import org.onosproject.routing.RouteEntry; | ||
57 | 47 | ||
58 | import java.util.Collections; | 48 | import java.util.Collections; |
59 | import java.util.HashSet; | 49 | import java.util.HashSet; |
60 | -import java.util.List; | ||
61 | import java.util.Set; | 50 | import java.util.Set; |
62 | import java.util.concurrent.ExecutorService; | 51 | import java.util.concurrent.ExecutorService; |
63 | 52 | ||
... | @@ -66,9 +55,6 @@ import static org.easymock.EasyMock.expect; | ... | @@ -66,9 +55,6 @@ import static org.easymock.EasyMock.expect; |
66 | import static org.easymock.EasyMock.replay; | 55 | import static org.easymock.EasyMock.replay; |
67 | import static org.easymock.EasyMock.reset; | 56 | import static org.easymock.EasyMock.reset; |
68 | import static org.easymock.EasyMock.verify; | 57 | import static org.easymock.EasyMock.verify; |
69 | -import static org.hamcrest.Matchers.is; | ||
70 | -import static org.junit.Assert.assertFalse; | ||
71 | -import static org.junit.Assert.assertThat; | ||
72 | 58 | ||
73 | /** | 59 | /** |
74 | * This class tests the intent synchronization function in the | 60 | * This class tests the intent synchronization function in the |
... | @@ -95,7 +81,7 @@ public class IntentSynchronizerTest extends AbstractIntentTest { | ... | @@ -95,7 +81,7 @@ public class IntentSynchronizerTest extends AbstractIntentTest { |
95 | PortNumber.portNumber(1)); | 81 | PortNumber.portNumber(1)); |
96 | 82 | ||
97 | private IntentSynchronizer intentSynchronizer; | 83 | private IntentSynchronizer intentSynchronizer; |
98 | - private final Set<Interface> interfaces = Sets.newHashSet(); | 84 | + private final Set<ConnectPoint> connectPoints = new HashSet<>(); |
99 | 85 | ||
100 | private static final ApplicationId APPID = | 86 | private static final ApplicationId APPID = |
101 | TestApplicationId.create("intent-sync-test"); | 87 | TestApplicationId.create("intent-sync-test"); |
... | @@ -107,7 +93,7 @@ public class IntentSynchronizerTest extends AbstractIntentTest { | ... | @@ -107,7 +93,7 @@ public class IntentSynchronizerTest extends AbstractIntentTest { |
107 | public void setUp() throws Exception { | 93 | public void setUp() throws Exception { |
108 | super.setUp(); | 94 | super.setUp(); |
109 | 95 | ||
110 | - setUpInterfaceService(); | 96 | + setUpConnectPoints(); |
111 | 97 | ||
112 | intentService = createMock(IntentService.class); | 98 | intentService = createMock(IntentService.class); |
113 | 99 | ||
... | @@ -115,131 +101,58 @@ public class IntentSynchronizerTest extends AbstractIntentTest { | ... | @@ -115,131 +101,58 @@ public class IntentSynchronizerTest extends AbstractIntentTest { |
115 | 101 | ||
116 | intentSynchronizer.coreService = new TestCoreService(); | 102 | intentSynchronizer.coreService = new TestCoreService(); |
117 | intentSynchronizer.clusterService = new TestClusterService(); | 103 | intentSynchronizer.clusterService = new TestClusterService(); |
118 | - intentSynchronizer.leadershipService = new TestLeadershipService(); | 104 | + intentSynchronizer.leadershipService = new LeadershipServiceAdapter(); |
119 | intentSynchronizer.intentService = intentService; | 105 | intentSynchronizer.intentService = intentService; |
120 | 106 | ||
121 | intentSynchronizer.activate(); | 107 | intentSynchronizer.activate(); |
122 | } | 108 | } |
123 | 109 | ||
124 | /** | 110 | /** |
125 | - * Sets up InterfaceService. | 111 | + * Sets up connect points. |
126 | */ | 112 | */ |
127 | - private void setUpInterfaceService() { | 113 | + private void setUpConnectPoints() { |
128 | - List<InterfaceIpAddress> interfaceIpAddresses1 = Lists.newArrayList(); | 114 | + connectPoints.add(SW1_ETH1); |
129 | - interfaceIpAddresses1.add(new InterfaceIpAddress( | 115 | + connectPoints.add(SW2_ETH1); |
130 | - IpAddress.valueOf("192.168.10.101"), | 116 | + connectPoints.add(SW3_ETH1); |
131 | - IpPrefix.valueOf("192.168.10.0/24"))); | 117 | + connectPoints.add(SW4_ETH1); |
132 | - Interface sw1Eth1 = new Interface(SW1_ETH1, | ||
133 | - interfaceIpAddresses1, MacAddress.valueOf("00:00:00:00:00:01"), | ||
134 | - VlanId.NONE); | ||
135 | - interfaces.add(sw1Eth1); | ||
136 | - | ||
137 | - List<InterfaceIpAddress> interfaceIpAddresses2 = Lists.newArrayList(); | ||
138 | - interfaceIpAddresses2.add( | ||
139 | - new InterfaceIpAddress(IpAddress.valueOf("192.168.20.101"), | ||
140 | - IpPrefix.valueOf("192.168.20.0/24"))); | ||
141 | - Interface sw2Eth1 = new Interface(SW2_ETH1, | ||
142 | - interfaceIpAddresses2, MacAddress.valueOf("00:00:00:00:00:02"), | ||
143 | - VlanId.NONE); | ||
144 | - interfaces.add(sw2Eth1); | ||
145 | - | ||
146 | - List<InterfaceIpAddress> interfaceIpAddresses3 = Lists.newArrayList(); | ||
147 | - interfaceIpAddresses3.add( | ||
148 | - new InterfaceIpAddress(IpAddress.valueOf("192.168.30.101"), | ||
149 | - IpPrefix.valueOf("192.168.30.0/24"))); | ||
150 | - Interface sw3Eth1 = new Interface(SW3_ETH1, | ||
151 | - interfaceIpAddresses3, MacAddress.valueOf("00:00:00:00:00:03"), | ||
152 | - VlanId.NONE); | ||
153 | - interfaces.add(sw3Eth1); | ||
154 | - | ||
155 | - InterfaceIpAddress interfaceIpAddress4 = | ||
156 | - new InterfaceIpAddress(IpAddress.valueOf("192.168.40.101"), | ||
157 | - IpPrefix.valueOf("192.168.40.0/24")); | ||
158 | - Interface sw4Eth1 = new Interface(SW4_ETH1, | ||
159 | - Lists.newArrayList(interfaceIpAddress4), | ||
160 | - MacAddress.valueOf("00:00:00:00:00:04"), | ||
161 | - VlanId.vlanId((short) 1)); | ||
162 | - | ||
163 | - interfaces.add(sw4Eth1); | ||
164 | } | 118 | } |
165 | 119 | ||
166 | /** | 120 | /** |
167 | * Tests the synchronization behavior of intent synchronizer. We set up | 121 | * Tests the synchronization behavior of intent synchronizer. We set up |
168 | * a discrepancy between the intent service state and the intent | 122 | * a discrepancy between the intent service state and the intent |
169 | * synchronizer's state and ensure that this is reconciled correctly. | 123 | * synchronizer's state and ensure that this is reconciled correctly. |
170 | - * | ||
171 | - * @throws TestUtilsException | ||
172 | */ | 124 | */ |
173 | @Test | 125 | @Test |
174 | - public void testIntentSync() throws TestUtilsException { | 126 | + public void testIntentSync() { |
175 | 127 | ||
176 | - // | ||
177 | // Construct routes and intents. | 128 | // Construct routes and intents. |
178 | // This test simulates the following cases during the master change | 129 | // This test simulates the following cases during the master change |
179 | // time interval: | 130 | // time interval: |
180 | - // 1. RouteEntry1 did not change and the intent also did not change. | 131 | + // 1. intent1 did not change and the intent also did not change. |
181 | - // 2. RouteEntry2 was deleted, but the intent was not deleted. | 132 | + // 2. intent2 was deleted, but the intent was not deleted. |
182 | - // 3. RouteEntry3 was newly added, and the intent was also submitted. | 133 | + // 3. intent3 was newly added, and the intent was also submitted. |
183 | - // 4. RouteEntry4 was updated to RouteEntry4Update, and the intent was | 134 | + // 4. intent4 was updated to RouteEntry4Update, and the intent was |
184 | // also updated to a new one. | 135 | // also updated to a new one. |
185 | - // 5. RouteEntry5 did not change, but its intent id changed. | 136 | + // 5. intent5 did not change, but its intent id changed. |
186 | - // 6. RouteEntry6 was newly added, but the intent was not submitted. | 137 | + // 6. intent6 was newly added, but the intent was not submitted. |
187 | - // | ||
188 | - RouteEntry routeEntry1 = new RouteEntry( | ||
189 | - Ip4Prefix.valueOf("1.1.1.0/24"), | ||
190 | - Ip4Address.valueOf("192.168.10.1")); | ||
191 | - | ||
192 | - RouteEntry routeEntry2 = new RouteEntry( | ||
193 | - Ip4Prefix.valueOf("2.2.2.0/24"), | ||
194 | - Ip4Address.valueOf("192.168.20.1")); | ||
195 | - | ||
196 | - RouteEntry routeEntry3 = new RouteEntry( | ||
197 | - Ip4Prefix.valueOf("3.3.3.0/24"), | ||
198 | - Ip4Address.valueOf("192.168.30.1")); | ||
199 | - | ||
200 | - RouteEntry routeEntry4 = new RouteEntry( | ||
201 | - Ip4Prefix.valueOf("4.4.4.0/24"), | ||
202 | - Ip4Address.valueOf("192.168.30.1")); | ||
203 | - | ||
204 | - RouteEntry routeEntry4Update = new RouteEntry( | ||
205 | - Ip4Prefix.valueOf("4.4.4.0/24"), | ||
206 | - Ip4Address.valueOf("192.168.20.1")); | ||
207 | - | ||
208 | - RouteEntry routeEntry5 = new RouteEntry( | ||
209 | - Ip4Prefix.valueOf("5.5.5.0/24"), | ||
210 | - Ip4Address.valueOf("192.168.10.1")); | ||
211 | - | ||
212 | - RouteEntry routeEntry6 = new RouteEntry( | ||
213 | - Ip4Prefix.valueOf("6.6.6.0/24"), | ||
214 | - Ip4Address.valueOf("192.168.10.1")); | ||
215 | - | ||
216 | - RouteEntry routeEntry7 = new RouteEntry( | ||
217 | - Ip4Prefix.valueOf("7.7.7.0/24"), | ||
218 | - Ip4Address.valueOf("192.168.10.1")); | ||
219 | 138 | ||
220 | MultiPointToSinglePointIntent intent1 = intentBuilder( | 139 | MultiPointToSinglePointIntent intent1 = intentBuilder( |
221 | - routeEntry1.prefix(), "00:00:00:00:00:01", SW1_ETH1); | 140 | + Ip4Prefix.valueOf("1.1.1.0/24"), "00:00:00:00:00:01", SW1_ETH1); |
222 | MultiPointToSinglePointIntent intent2 = intentBuilder( | 141 | MultiPointToSinglePointIntent intent2 = intentBuilder( |
223 | - routeEntry2.prefix(), "00:00:00:00:00:02", SW2_ETH1); | 142 | + Ip4Prefix.valueOf("2.2.2.0/24"), "00:00:00:00:00:02", SW2_ETH1); |
224 | MultiPointToSinglePointIntent intent3 = intentBuilder( | 143 | MultiPointToSinglePointIntent intent3 = intentBuilder( |
225 | - routeEntry3.prefix(), "00:00:00:00:00:03", SW3_ETH1); | 144 | + Ip4Prefix.valueOf("3.3.3.0/24"), "00:00:00:00:00:03", SW3_ETH1); |
226 | MultiPointToSinglePointIntent intent4 = intentBuilder( | 145 | MultiPointToSinglePointIntent intent4 = intentBuilder( |
227 | - routeEntry4.prefix(), "00:00:00:00:00:03", SW3_ETH1); | 146 | + Ip4Prefix.valueOf("4.4.4.0/24"), "00:00:00:00:00:03", SW3_ETH1); |
228 | MultiPointToSinglePointIntent intent4Update = intentBuilder( | 147 | MultiPointToSinglePointIntent intent4Update = intentBuilder( |
229 | - routeEntry4Update.prefix(), "00:00:00:00:00:02", SW2_ETH1); | 148 | + Ip4Prefix.valueOf("4.4.4.0/24"), "00:00:00:00:00:02", SW2_ETH1); |
230 | MultiPointToSinglePointIntent intent5 = intentBuilder( | 149 | MultiPointToSinglePointIntent intent5 = intentBuilder( |
231 | - routeEntry5.prefix(), "00:00:00:00:00:01", SW1_ETH1); | 150 | + Ip4Prefix.valueOf("5.5.5.0/24"), "00:00:00:00:00:01", SW1_ETH1); |
232 | MultiPointToSinglePointIntent intent7 = intentBuilder( | 151 | MultiPointToSinglePointIntent intent7 = intentBuilder( |
233 | - routeEntry7.prefix(), "00:00:00:00:00:01", SW1_ETH1); | 152 | + Ip4Prefix.valueOf("7.7.7.0/24"), "00:00:00:00:00:01", SW1_ETH1); |
234 | - | ||
235 | - // Compose a intent, which is equal to intent5 but the id is different. | ||
236 | - MultiPointToSinglePointIntent intent5New = | ||
237 | - staticIntentBuilder(intent5, routeEntry5, "00:00:00:00:00:01"); | ||
238 | - assertThat(IntentUtils.intentsAreEqual(intent5, intent5New), is(true)); | ||
239 | - assertFalse(intent5.equals(intent5New)); | ||
240 | 153 | ||
241 | MultiPointToSinglePointIntent intent6 = intentBuilder( | 154 | MultiPointToSinglePointIntent intent6 = intentBuilder( |
242 | - routeEntry6.prefix(), "00:00:00:00:00:01", SW1_ETH1); | 155 | + Ip4Prefix.valueOf("6.6.6.0/24"), "00:00:00:00:00:01", SW1_ETH1); |
243 | 156 | ||
244 | // Set up expectation | 157 | // Set up expectation |
245 | Set<Intent> intents = new HashSet<>(); | 158 | Set<Intent> intents = new HashSet<>(); |
... | @@ -395,13 +308,9 @@ public class IntentSynchronizerTest extends AbstractIntentTest { | ... | @@ -395,13 +308,9 @@ public class IntentSynchronizerTest extends AbstractIntentTest { |
395 | DefaultTrafficTreatment.builder(); | 308 | DefaultTrafficTreatment.builder(); |
396 | treatmentBuilder.setEthDst(MacAddress.valueOf(nextHopMacAddress)); | 309 | treatmentBuilder.setEthDst(MacAddress.valueOf(nextHopMacAddress)); |
397 | 310 | ||
398 | - Set<ConnectPoint> ingressPoints = new HashSet<>(); | 311 | + Set<ConnectPoint> ingressPoints = new HashSet<>(connectPoints); |
399 | - for (Interface intf : interfaces) { | 312 | + ingressPoints.remove(egressPoint); |
400 | - if (!intf.connectPoint().equals(egressPoint)) { | 313 | + |
401 | - ConnectPoint srcPort = intf.connectPoint(); | ||
402 | - ingressPoints.add(srcPort); | ||
403 | - } | ||
404 | - } | ||
405 | MultiPointToSinglePointIntent intent = | 314 | MultiPointToSinglePointIntent intent = |
406 | MultiPointToSinglePointIntent.builder() | 315 | MultiPointToSinglePointIntent.builder() |
407 | .appId(APPID) | 316 | .appId(APPID) |
... | @@ -414,29 +323,6 @@ public class IntentSynchronizerTest extends AbstractIntentTest { | ... | @@ -414,29 +323,6 @@ public class IntentSynchronizerTest extends AbstractIntentTest { |
414 | return intent; | 323 | return intent; |
415 | } | 324 | } |
416 | 325 | ||
417 | - /** | ||
418 | - * A static MultiPointToSinglePointIntent builder, the returned intent is | ||
419 | - * equal to the input intent except that the id is different. | ||
420 | - * | ||
421 | - * @param intent the intent to be used for building a new intent | ||
422 | - * @param routeEntry the relative routeEntry of the intent | ||
423 | - * @return the newly constructed MultiPointToSinglePointIntent | ||
424 | - * @throws TestUtilsException | ||
425 | - */ | ||
426 | - private MultiPointToSinglePointIntent staticIntentBuilder( | ||
427 | - MultiPointToSinglePointIntent intent, RouteEntry routeEntry, | ||
428 | - String nextHopMacAddress) throws TestUtilsException { | ||
429 | - | ||
430 | - // Use a different egress ConnectPoint with that in intent | ||
431 | - // to generate a different id | ||
432 | - MultiPointToSinglePointIntent intentNew = intentBuilder( | ||
433 | - routeEntry.prefix(), nextHopMacAddress, SW2_ETH1); | ||
434 | - TestUtils.setField(intentNew, "egressPoint", intent.egressPoint()); | ||
435 | - TestUtils.setField(intentNew, | ||
436 | - "ingressPoints", intent.ingressPoints()); | ||
437 | - return intentNew; | ||
438 | - } | ||
439 | - | ||
440 | private class TestIntentSynchronizer extends IntentSynchronizer { | 326 | private class TestIntentSynchronizer extends IntentSynchronizer { |
441 | @Override | 327 | @Override |
442 | protected ExecutorService createExecutor() { | 328 | protected ExecutorService createExecutor() { |
... | @@ -457,8 +343,4 @@ public class IntentSynchronizerTest extends AbstractIntentTest { | ... | @@ -457,8 +343,4 @@ public class IntentSynchronizerTest extends AbstractIntentTest { |
457 | return LOCAL_NODE; | 343 | return LOCAL_NODE; |
458 | } | 344 | } |
459 | } | 345 | } |
460 | - | ||
461 | - private class TestLeadershipService extends LeadershipServiceAdapter { | ||
462 | - | ||
463 | - } | ||
464 | } | 346 | } | ... | ... |
... | @@ -18,7 +18,6 @@ package org.onosproject.sdnip; | ... | @@ -18,7 +18,6 @@ package org.onosproject.sdnip; |
18 | import com.google.common.collect.Sets; | 18 | import com.google.common.collect.Sets; |
19 | import org.junit.Before; | 19 | import org.junit.Before; |
20 | import org.junit.Test; | 20 | import org.junit.Test; |
21 | -import org.onlab.junit.TestUtils.TestUtilsException; | ||
22 | import org.onlab.packet.Ethernet; | 21 | import org.onlab.packet.Ethernet; |
23 | import org.onlab.packet.IPv4; | 22 | import org.onlab.packet.IPv4; |
24 | import org.onlab.packet.IpAddress; | 23 | import org.onlab.packet.IpAddress; |
... | @@ -47,7 +46,6 @@ import org.onosproject.net.intent.Key; | ... | @@ -47,7 +46,6 @@ import org.onosproject.net.intent.Key; |
47 | import org.onosproject.net.intent.PointToPointIntent; | 46 | import org.onosproject.net.intent.PointToPointIntent; |
48 | import org.onosproject.routing.IntentSynchronizationService; | 47 | import org.onosproject.routing.IntentSynchronizationService; |
49 | import org.onosproject.routing.config.BgpConfig; | 48 | import org.onosproject.routing.config.BgpConfig; |
50 | -import org.onosproject.routing.config.BgpPeer; | ||
51 | 49 | ||
52 | import java.util.ArrayList; | 50 | import java.util.ArrayList; |
53 | import java.util.Collections; | 51 | import java.util.Collections; |
... | @@ -82,7 +80,6 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { | ... | @@ -82,7 +80,6 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { |
82 | 80 | ||
83 | private Set<BgpConfig.BgpSpeakerConfig> bgpSpeakers; | 81 | private Set<BgpConfig.BgpSpeakerConfig> bgpSpeakers; |
84 | private Map<String, Interface> interfaces; | 82 | private Map<String, Interface> interfaces; |
85 | - private Map<IpAddress, BgpPeer> peers; | ||
86 | 83 | ||
87 | private BgpConfig bgpConfig; | 84 | private BgpConfig bgpConfig; |
88 | 85 | ||
... | @@ -135,7 +132,6 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { | ... | @@ -135,7 +132,6 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { |
135 | // These will set expectations on routingConfig and interfaceService | 132 | // These will set expectations on routingConfig and interfaceService |
136 | bgpSpeakers = setUpBgpSpeakers(); | 133 | bgpSpeakers = setUpBgpSpeakers(); |
137 | interfaces = Collections.unmodifiableMap(setUpInterfaces()); | 134 | interfaces = Collections.unmodifiableMap(setUpInterfaces()); |
138 | - peers = setUpPeers(); | ||
139 | 135 | ||
140 | initPeerConnectivity(); | 136 | initPeerConnectivity(); |
141 | intentList = setUpIntentList(); | 137 | intentList = setUpIntentList(); |
... | @@ -280,39 +276,6 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { | ... | @@ -280,39 +276,6 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { |
280 | } | 276 | } |
281 | 277 | ||
282 | /** | 278 | /** |
283 | - * Sets up BGP daemon peers. | ||
284 | - * | ||
285 | - * @return configured BGP peers as a MAP from peer IP address to BgpPeer | ||
286 | - */ | ||
287 | - private Map<IpAddress, BgpPeer> setUpPeers() { | ||
288 | - | ||
289 | - Map<IpAddress, BgpPeer> configuredPeers = new HashMap<>(); | ||
290 | - | ||
291 | - String peerSw1Eth1 = "192.168.10.1"; | ||
292 | - configuredPeers.put(IpAddress.valueOf(peerSw1Eth1), | ||
293 | - new BgpPeer(dpid1, 1, peerSw1Eth1)); | ||
294 | - | ||
295 | - // Two BGP peers are connected to switch 2 port 1. | ||
296 | - String peer1Sw2Eth1 = "192.168.20.1"; | ||
297 | - configuredPeers.put(IpAddress.valueOf(peer1Sw2Eth1), | ||
298 | - new BgpPeer(dpid2, 1, peer1Sw2Eth1)); | ||
299 | - | ||
300 | - String peer2Sw2Eth1 = "192.168.30.1"; | ||
301 | - configuredPeers.put(IpAddress.valueOf(peer2Sw2Eth1), | ||
302 | - new BgpPeer(dpid2, 1, peer2Sw2Eth1)); | ||
303 | - | ||
304 | - String peer3Sw3Eth1 = "192.168.40.1"; | ||
305 | - configuredPeers.put(IpAddress.valueOf(peer3Sw3Eth1), | ||
306 | - new BgpPeer(dpid3, 1, peer3Sw3Eth1)); | ||
307 | - | ||
308 | - String peer4Sw3Eth1 = "192.168.50.1"; | ||
309 | - configuredPeers.put(IpAddress.valueOf(peer4Sw3Eth1), | ||
310 | - new BgpPeer(dpid3, 1, peer4Sw3Eth1)); | ||
311 | - | ||
312 | - return configuredPeers; | ||
313 | - } | ||
314 | - | ||
315 | - /** | ||
316 | * Sets up expected point to point intent list. | 279 | * Sets up expected point to point intent list. |
317 | * | 280 | * |
318 | * @return point to point intent list | 281 | * @return point to point intent list |
... | @@ -613,10 +576,8 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { | ... | @@ -613,10 +576,8 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { |
613 | 576 | ||
614 | /** | 577 | /** |
615 | * Initializes peer connectivity testing environment. | 578 | * Initializes peer connectivity testing environment. |
616 | - * | ||
617 | - * @throws TestUtilsException if exceptions when using TestUtils | ||
618 | */ | 579 | */ |
619 | - private void initPeerConnectivity() throws TestUtilsException { | 580 | + private void initPeerConnectivity() { |
620 | expect(bgpConfig.bgpSpeakers()).andReturn(bgpSpeakers).anyTimes(); | 581 | expect(bgpConfig.bgpSpeakers()).andReturn(bgpSpeakers).anyTimes(); |
621 | replay(bgpConfig); | 582 | replay(bgpConfig); |
622 | expect(networkConfigService.getConfig(APPID, BgpConfig.class)) | 583 | expect(networkConfigService.getConfig(APPID, BgpConfig.class)) |
... | @@ -710,6 +671,7 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { | ... | @@ -710,6 +671,7 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { |
710 | expect(bgpConfig.bgpSpeakers()).andReturn(Collections.emptySet()).anyTimes(); | 671 | expect(bgpConfig.bgpSpeakers()).andReturn(Collections.emptySet()).anyTimes(); |
711 | replay(bgpConfig); | 672 | replay(bgpConfig); |
712 | 673 | ||
674 | + // We don't expect any intents in this case | ||
713 | reset(intentSynchronizer); | 675 | reset(intentSynchronizer); |
714 | replay(intentSynchronizer); | 676 | replay(intentSynchronizer); |
715 | peerConnectivityManager.start(); | 677 | peerConnectivityManager.start(); |
... | @@ -722,10 +684,20 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { | ... | @@ -722,10 +684,20 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { |
722 | */ | 684 | */ |
723 | @Test | 685 | @Test |
724 | public void testNoPeerInterface() { | 686 | public void testNoPeerInterface() { |
725 | - String peerSw100Eth1 = "192.168.200.1"; | 687 | + IpAddress ip = IpAddress.valueOf("1.1.1.1"); |
726 | - peers.put(IpAddress.valueOf(peerSw100Eth1), | 688 | + bgpSpeakers.clear(); |
727 | - new BgpPeer("00:00:00:00:00:00:01:00", 1, peerSw100Eth1)); | 689 | + bgpSpeakers.add(new BgpConfig.BgpSpeakerConfig(Optional.of("foo"), |
728 | - testConnectionSetup(); | 690 | + VlanId.NONE, s1Eth100, Collections.singleton(ip))); |
691 | + reset(interfaceService); | ||
692 | + interfaceService.addListener(anyObject(InterfaceListener.class)); | ||
693 | + expect(interfaceService.getMatchingInterface(ip)).andReturn(null).anyTimes(); | ||
694 | + replay(interfaceService); | ||
695 | + | ||
696 | + // We don't expect any intents in this case | ||
697 | + reset(intentSynchronizer); | ||
698 | + replay(intentSynchronizer); | ||
699 | + peerConnectivityManager.start(); | ||
700 | + verify(intentSynchronizer); | ||
729 | } | 701 | } |
730 | 702 | ||
731 | } | 703 | } | ... | ... |
-
Please register or login to post a comment