Jonathan Hart

Remove old config classes from routing bundle.

Change-Id: Ifc8ff03674c1cfb9e3cde86b9994b8362744840d
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 -}
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 -}
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
......
...@@ -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 }
......