Removed config app that used to read addresses.json configuration.
Change-Id: I3b371831b0914e4ec99eb5b9d53053c5618e5f8e
Showing
12 changed files
with
0 additions
and
441 deletions
... | @@ -22,5 +22,4 @@ | ... | @@ -22,5 +22,4 @@ |
22 | <artifact>mvn:${project.groupId}/onos-app-routing-api/${project.version}</artifact> | 22 | <artifact>mvn:${project.groupId}/onos-app-routing-api/${project.version}</artifact> |
23 | <artifact>mvn:${project.groupId}/onos-app-routing/${project.version}</artifact> | 23 | <artifact>mvn:${project.groupId}/onos-app-routing/${project.version}</artifact> |
24 | <artifact>mvn:${project.groupId}/onos-app-proxyarp/${project.version}</artifact> | 24 | <artifact>mvn:${project.groupId}/onos-app-proxyarp/${project.version}</artifact> |
25 | - <artifact>mvn:${project.groupId}/onos-app-config/${project.version}</artifact> | ||
26 | </app> | 25 | </app> | ... | ... |
... | @@ -20,7 +20,6 @@ | ... | @@ -20,7 +20,6 @@ |
20 | description="${project.description}"> | 20 | description="${project.description}"> |
21 | <feature>onos-api</feature> | 21 | <feature>onos-api</feature> |
22 | <bundle>mvn:${project.groupId}/onos-app-routing-api/${project.version}</bundle> | 22 | <bundle>mvn:${project.groupId}/onos-app-routing-api/${project.version}</bundle> |
23 | - <bundle>mvn:${project.groupId}/onos-app-config/${project.version}</bundle> | ||
24 | <bundle>mvn:${project.groupId}/onos-app-proxyarp/${project.version}</bundle> | 23 | <bundle>mvn:${project.groupId}/onos-app-proxyarp/${project.version}</bundle> |
25 | <bundle>mvn:${project.groupId}/onos-app-bgprouter/${project.version}</bundle> | 24 | <bundle>mvn:${project.groupId}/onos-app-bgprouter/${project.version}</bundle> |
26 | <bundle>mvn:${project.groupId}/onos-app-routing/${project.version}</bundle> | 25 | <bundle>mvn:${project.groupId}/onos-app-routing/${project.version}</bundle> | ... | ... |
... | @@ -60,12 +60,6 @@ | ... | @@ -60,12 +60,6 @@ |
60 | 60 | ||
61 | <dependency> | 61 | <dependency> |
62 | <groupId>org.onosproject</groupId> | 62 | <groupId>org.onosproject</groupId> |
63 | - <artifactId>onos-app-config</artifactId> | ||
64 | - <version>${project.version}</version> | ||
65 | - </dependency> | ||
66 | - | ||
67 | - <dependency> | ||
68 | - <groupId>org.onosproject</groupId> | ||
69 | <artifactId>onos-app-proxyarp</artifactId> | 63 | <artifactId>onos-app-proxyarp</artifactId> |
70 | <version>${project.version}</version> | 64 | <version>${project.version}</version> |
71 | </dependency> | 65 | </dependency> | ... | ... |
apps/config/pom.xml
deleted
100644 → 0
1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
2 | -<!-- | ||
3 | - ~ Copyright 2014 Open Networking Laboratory | ||
4 | - ~ | ||
5 | - ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | - ~ you may not use this file except in compliance with the License. | ||
7 | - ~ You may obtain a copy of the License at | ||
8 | - ~ | ||
9 | - ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | - ~ | ||
11 | - ~ Unless required by applicable law or agreed to in writing, software | ||
12 | - ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | - ~ See the License for the specific language governing permissions and | ||
15 | - ~ limitations under the License. | ||
16 | - --> | ||
17 | -<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
18 | - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
19 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
20 | - <modelVersion>4.0.0</modelVersion> | ||
21 | - | ||
22 | - <parent> | ||
23 | - <groupId>org.onosproject</groupId> | ||
24 | - <artifactId>onos-apps</artifactId> | ||
25 | - <version>1.4.0-SNAPSHOT</version> | ||
26 | - <relativePath>../pom.xml</relativePath> | ||
27 | - </parent> | ||
28 | - | ||
29 | - <artifactId>onos-app-config</artifactId> | ||
30 | - <packaging>bundle</packaging> | ||
31 | - | ||
32 | - <description>Network configuration application</description> | ||
33 | - | ||
34 | - <properties> | ||
35 | - <onos.app.name>org.onosproject.config</onos.app.name> | ||
36 | - </properties> | ||
37 | - | ||
38 | - <dependencies> | ||
39 | - <dependency> | ||
40 | - <groupId>com.fasterxml.jackson.core</groupId> | ||
41 | - <artifactId>jackson-databind</artifactId> | ||
42 | - </dependency> | ||
43 | - <dependency> | ||
44 | - <groupId>com.fasterxml.jackson.core</groupId> | ||
45 | - <artifactId>jackson-annotations</artifactId> | ||
46 | - </dependency> | ||
47 | - <dependency> | ||
48 | - <groupId>org.onosproject</groupId> | ||
49 | - <artifactId>onlab-misc</artifactId> | ||
50 | - </dependency> | ||
51 | - </dependencies> | ||
52 | - | ||
53 | -</project> |
1 | -/* | ||
2 | - * Copyright 2014 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.config; | ||
17 | - | ||
18 | -import java.util.Collections; | ||
19 | -import java.util.List; | ||
20 | - | ||
21 | -import com.fasterxml.jackson.annotation.JsonProperty; | ||
22 | - | ||
23 | -/** | ||
24 | - * Object to store address configuration read from a JSON file. | ||
25 | - */ | ||
26 | -public class AddressConfiguration { | ||
27 | - | ||
28 | - private List<AddressEntry> addresses; | ||
29 | - | ||
30 | - /** | ||
31 | - * Gets a list of addresses in the system. | ||
32 | - * | ||
33 | - * @return the list of addresses | ||
34 | - */ | ||
35 | - public List<AddressEntry> getAddresses() { | ||
36 | - return Collections.unmodifiableList(addresses); | ||
37 | - } | ||
38 | - | ||
39 | - /** | ||
40 | - * Sets a list of addresses in the system. | ||
41 | - * | ||
42 | - * @param addresses the list of addresses | ||
43 | - */ | ||
44 | - @JsonProperty("addresses") | ||
45 | - public void setAddresses(List<AddressEntry> addresses) { | ||
46 | - this.addresses = addresses; | ||
47 | - } | ||
48 | - | ||
49 | -} |
1 | -/* | ||
2 | - * Copyright 2014-2015 Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | -package org.onosproject.config; | ||
17 | - | ||
18 | -import com.fasterxml.jackson.annotation.JsonProperty; | ||
19 | - | ||
20 | -import java.util.List; | ||
21 | - | ||
22 | -/** | ||
23 | - * Represents a set of addresses bound to a port. | ||
24 | - */ | ||
25 | -public class AddressEntry { | ||
26 | - private String dpid; | ||
27 | - private long portNumber; | ||
28 | - private List<String> ipAddresses; | ||
29 | - private String macAddress; | ||
30 | - private Short vlan; | ||
31 | - | ||
32 | - public String getDpid() { | ||
33 | - return dpid; | ||
34 | - } | ||
35 | - | ||
36 | - @JsonProperty("dpid") | ||
37 | - public void setDpid(String strDpid) { | ||
38 | - this.dpid = strDpid; | ||
39 | - } | ||
40 | - | ||
41 | - public long getPortNumber() { | ||
42 | - return portNumber; | ||
43 | - } | ||
44 | - | ||
45 | - @JsonProperty("port") | ||
46 | - public void setPortNumber(long portNumber) { | ||
47 | - this.portNumber = portNumber; | ||
48 | - } | ||
49 | - | ||
50 | - public List<String> getIpAddresses() { | ||
51 | - return ipAddresses; | ||
52 | - } | ||
53 | - | ||
54 | - @JsonProperty("ips") | ||
55 | - public void setIpAddresses(List<String> strIps) { | ||
56 | - this.ipAddresses = strIps; | ||
57 | - } | ||
58 | - | ||
59 | - public String getMacAddress() { | ||
60 | - return macAddress; | ||
61 | - } | ||
62 | - | ||
63 | - @JsonProperty("mac") | ||
64 | - public void setMacAddress(String macAddress) { | ||
65 | - this.macAddress = macAddress; | ||
66 | - } | ||
67 | - | ||
68 | - public Short getVlan() { | ||
69 | - return vlan; | ||
70 | - } | ||
71 | - | ||
72 | - @JsonProperty("vlan") | ||
73 | - public void setVlan(short vlan) { | ||
74 | - this.vlan = vlan; | ||
75 | - } | ||
76 | -} |
1 | -/* | ||
2 | - * Copyright 2014-2015 Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | -package org.onosproject.config; | ||
17 | - | ||
18 | -import static org.slf4j.LoggerFactory.getLogger; | ||
19 | - | ||
20 | -import java.io.File; | ||
21 | -import java.io.FileNotFoundException; | ||
22 | -import java.io.IOException; | ||
23 | -import java.util.HashSet; | ||
24 | -import java.util.Set; | ||
25 | - | ||
26 | -import org.apache.felix.scr.annotations.Activate; | ||
27 | -import org.apache.felix.scr.annotations.Component; | ||
28 | -import org.apache.felix.scr.annotations.Deactivate; | ||
29 | -import org.apache.felix.scr.annotations.Reference; | ||
30 | -import org.apache.felix.scr.annotations.ReferenceCardinality; | ||
31 | -import org.apache.felix.scr.annotations.Service; | ||
32 | -import org.onlab.packet.IpAddress; | ||
33 | -import org.onlab.packet.IpPrefix; | ||
34 | -import org.onlab.packet.MacAddress; | ||
35 | -import org.onlab.packet.VlanId; | ||
36 | -import org.onosproject.net.ConnectPoint; | ||
37 | -import org.onosproject.net.DeviceId; | ||
38 | -import org.onosproject.net.PortNumber; | ||
39 | -import org.onosproject.net.host.HostAdminService; | ||
40 | -import org.onosproject.net.host.InterfaceIpAddress; | ||
41 | -import org.onosproject.net.host.PortAddresses; | ||
42 | -import org.slf4j.Logger; | ||
43 | - | ||
44 | -import com.fasterxml.jackson.databind.ObjectMapper; | ||
45 | - | ||
46 | -/** | ||
47 | - * Simple configuration module to read in supplementary network configuration | ||
48 | - * from a file. | ||
49 | - */ | ||
50 | -@Component(immediate = true) | ||
51 | -@Service | ||
52 | -public class NetworkConfigReader implements NetworkConfigService { | ||
53 | - | ||
54 | - private final Logger log = getLogger(getClass()); | ||
55 | - | ||
56 | - // Current working is /opt/onos/apache-karaf-* | ||
57 | - // TODO: Set the path to /opt/onos/config | ||
58 | - private static final String CONFIG_DIR = "../config"; | ||
59 | - private static final String DEFAULT_CONFIG_FILE = "addresses.json"; | ||
60 | - private String configFileName = DEFAULT_CONFIG_FILE; | ||
61 | - | ||
62 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
63 | - protected HostAdminService hostAdminService; | ||
64 | - | ||
65 | - @Activate | ||
66 | - protected void activate() { | ||
67 | - AddressConfiguration config = readNetworkConfig(); | ||
68 | - if (config != null) { | ||
69 | - applyNetworkConfig(config); | ||
70 | - } | ||
71 | - log.info("Started network config reader"); | ||
72 | - } | ||
73 | - | ||
74 | - @Deactivate | ||
75 | - protected void deactivate() { | ||
76 | - log.info("Stopped"); | ||
77 | - } | ||
78 | - | ||
79 | - /** | ||
80 | - * Reads the network configuration. | ||
81 | - * | ||
82 | - * @return the network configuration on success, otherwise null | ||
83 | - */ | ||
84 | - private AddressConfiguration readNetworkConfig() { | ||
85 | - File configFile = new File(CONFIG_DIR, configFileName); | ||
86 | - ObjectMapper mapper = new ObjectMapper(); | ||
87 | - | ||
88 | - try { | ||
89 | - log.info("Loading config: {}", configFile.getAbsolutePath()); | ||
90 | - AddressConfiguration config = | ||
91 | - mapper.readValue(configFile, AddressConfiguration.class); | ||
92 | - | ||
93 | - return config; | ||
94 | - } catch (FileNotFoundException e) { | ||
95 | - log.warn("Configuration file not found: {}", configFileName); | ||
96 | - } catch (IOException e) { | ||
97 | - log.error("Error loading configuration", e); | ||
98 | - } | ||
99 | - | ||
100 | - return null; | ||
101 | - } | ||
102 | - | ||
103 | - /** | ||
104 | - * Applies the network configuration. | ||
105 | - * | ||
106 | - * @param config the network configuration to apply | ||
107 | - */ | ||
108 | - private void applyNetworkConfig(AddressConfiguration config) { | ||
109 | - for (AddressEntry entry : config.getAddresses()) { | ||
110 | - ConnectPoint cp = new ConnectPoint( | ||
111 | - DeviceId.deviceId(dpidToUri(entry.getDpid())), | ||
112 | - PortNumber.portNumber(entry.getPortNumber())); | ||
113 | - | ||
114 | - Set<InterfaceIpAddress> interfaceIpAddresses = new HashSet<>(); | ||
115 | - for (String strIp : entry.getIpAddresses()) { | ||
116 | - // Get the IP address and the subnet mask length | ||
117 | - try { | ||
118 | - String[] splits = strIp.split("/"); | ||
119 | - if (splits.length != 2) { | ||
120 | - throw new IllegalArgumentException( | ||
121 | - "Invalid IP address and prefix length format"); | ||
122 | - } | ||
123 | - // NOTE: IpPrefix will mask-out the bits after the prefix length. | ||
124 | - IpPrefix subnet = IpPrefix.valueOf(strIp); | ||
125 | - IpAddress addr = IpAddress.valueOf(splits[0]); | ||
126 | - InterfaceIpAddress ia = | ||
127 | - new InterfaceIpAddress(addr, subnet); | ||
128 | - interfaceIpAddresses.add(ia); | ||
129 | - } catch (IllegalArgumentException e) { | ||
130 | - log.warn("Bad format for IP address in config: {}", strIp); | ||
131 | - } | ||
132 | - } | ||
133 | - | ||
134 | - MacAddress macAddress = null; | ||
135 | - if (entry.getMacAddress() != null) { | ||
136 | - try { | ||
137 | - macAddress = MacAddress.valueOf(entry.getMacAddress()); | ||
138 | - } catch (IllegalArgumentException e) { | ||
139 | - log.warn("Bad format for MAC address in config: {}", | ||
140 | - entry.getMacAddress()); | ||
141 | - } | ||
142 | - } | ||
143 | - | ||
144 | - VlanId vlan = null; | ||
145 | - if (entry.getVlan() == null) { | ||
146 | - vlan = VlanId.NONE; | ||
147 | - } else { | ||
148 | - try { | ||
149 | - vlan = VlanId.vlanId(entry.getVlan()); | ||
150 | - } catch (IllegalArgumentException e) { | ||
151 | - log.warn("Bad format for VLAN id in config: {}", | ||
152 | - entry.getVlan()); | ||
153 | - vlan = VlanId.NONE; | ||
154 | - } | ||
155 | - } | ||
156 | - | ||
157 | - PortAddresses addresses = new PortAddresses(cp, | ||
158 | - interfaceIpAddresses, macAddress, vlan); | ||
159 | - hostAdminService.bindAddressesToPort(addresses); | ||
160 | - } | ||
161 | - } | ||
162 | - | ||
163 | - private static String dpidToUri(String dpid) { | ||
164 | - return "of:" + dpid.replace(":", ""); | ||
165 | - } | ||
166 | -} |
1 | -/* | ||
2 | - * Copyright 2015 Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | -package org.onosproject.config; | ||
17 | - | ||
18 | -/** | ||
19 | - * Service interface exported by the Network Configuration. | ||
20 | - * | ||
21 | - * @deprecated in Drake; see org.onosproject.net.config | ||
22 | - */ | ||
23 | -@Deprecated | ||
24 | -public interface NetworkConfigService { | ||
25 | -} |
1 | -/* | ||
2 | - * Copyright 2014 Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -/** | ||
18 | - * Simple configuration module to read in supplementary network configuration | ||
19 | - * from a file. | ||
20 | - */ | ||
21 | -package org.onosproject.config; |
1 | -{ | ||
2 | - "addresses" : [ | ||
3 | - { | ||
4 | - "dpid" : "00:00:00:00:00:00:00:a3", | ||
5 | - "port" : "1", | ||
6 | - "ips" : ["192.168.10.101/24"], | ||
7 | - "mac" : "00:00:00:00:00:01", | ||
8 | - "vlan" : "1" | ||
9 | - }, | ||
10 | - { | ||
11 | - "dpid" : "00:00:00:00:00:00:00:a5", | ||
12 | - "port" : "1", | ||
13 | - "ips" : ["192.168.20.101/24"], | ||
14 | - "mac" : "00:00:00:00:00:01", | ||
15 | - "vlan" : "2" | ||
16 | - }, | ||
17 | - { | ||
18 | - "dpid" : "00:00:00:00:00:00:00:a2", | ||
19 | - "port" : "1", | ||
20 | - "ips" : ["192.168.30.101/24"], | ||
21 | - "mac" : "00:00:00:00:00:01" | ||
22 | - }, | ||
23 | - { | ||
24 | - "dpid" : "00:00:00:00:00:00:00:a6", | ||
25 | - "port" : "1", | ||
26 | - "ips" : ["192.168.40.101/24"], | ||
27 | - "mac" : "00:00:00:00:00:01" | ||
28 | - }, | ||
29 | - { | ||
30 | - "dpid" : "00:00:00:00:00:00:00:a4", | ||
31 | - "port" : "4", | ||
32 | - "ips" : ["192.168.60.101/24"], | ||
33 | - "mac" : "00:00:00:00:00:01" | ||
34 | - } | ||
35 | - ] | ||
36 | -} |
... | @@ -37,7 +37,6 @@ | ... | @@ -37,7 +37,6 @@ |
37 | <module>fwd</module> | 37 | <module>fwd</module> |
38 | <module>mobility</module> | 38 | <module>mobility</module> |
39 | <module>proxyarp</module> | 39 | <module>proxyarp</module> |
40 | - <module>config</module> | ||
41 | <module>sdnip</module> | 40 | <module>sdnip</module> |
42 | <module>optical</module> | 41 | <module>optical</module> |
43 | <module>metrics</module> | 42 | <module>metrics</module> | ... | ... |
... | @@ -69,12 +69,6 @@ | ... | @@ -69,12 +69,6 @@ |
69 | </dependency> | 69 | </dependency> |
70 | 70 | ||
71 | <dependency> | 71 | <dependency> |
72 | - <groupId>org.onosproject</groupId> | ||
73 | - <artifactId>onos-app-config</artifactId> | ||
74 | - <version>${project.version}</version> | ||
75 | - </dependency> | ||
76 | - | ||
77 | - <dependency> | ||
78 | <groupId>org.apache.karaf.shell</groupId> | 72 | <groupId>org.apache.karaf.shell</groupId> |
79 | <artifactId>org.apache.karaf.shell.console</artifactId> | 73 | <artifactId>org.apache.karaf.shell.console</artifactId> |
80 | </dependency> | 74 | </dependency> | ... | ... |
-
Please register or login to post a comment