cheng fan
Committed by Gerrit Code Review

[ONOS-1925]

1.fix javadocs bugs.
2.add pcep tunnel provider;
3.change pcep to pcep app;
4.fix some bugs according to review suggestions.

Change-Id: I4b90d9bf871dee3be70615d66db3d74f2fd85389
Showing 27 changed files with 1165 additions and 0 deletions
1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2 + <modelVersion>4.0.0</modelVersion>
3 + <parent>
4 + <groupId>org.onosproject</groupId>
5 + <artifactId>onos-apps</artifactId>
6 + <version>1.2.0-SNAPSHOT</version>
7 + </parent>
8 + <artifactId>onos-app-pcep-api</artifactId>
9 + <packaging>bundle</packaging>
10 +</project>
...\ No newline at end of file ...\ No newline at end of file
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.pcep.api;
17 +
18 +import org.onosproject.net.DeviceId;
19 +
20 +/**
21 + * Abstraction of an PCEP controller. Serves as a one stop shop for obtaining
22 + * PCEP devices and (un)register listeners on PCEP events
23 + */
24 +public interface PcepController {
25 +
26 + /**
27 + * Returns all switches known to this PCEP controller.
28 + *
29 + * @return Iterable of did elements
30 + */
31 + public Iterable<PcepSwitch> getSwitches();
32 +
33 + /**
34 + * Return a switch with a specified did.
35 + *
36 + * @param did of a device
37 + * @return a pcep device
38 + */
39 + public PcepSwitch getSwitch(PcepDpid did);
40 +
41 + /**
42 + * Register a listener for meta events that occur to PCEP devices.
43 + *
44 + * @param listener the listener to notify
45 + */
46 + public void addListener(PcepSwitchListener listener);
47 +
48 + /**
49 + * Unregister a listener.
50 + *
51 + * @param listener the listener to unregister
52 + */
53 + public void removeListener(PcepSwitchListener listener);
54 +
55 + /**
56 + * Register a listener for meta events that occur to PCEP links.
57 + *
58 + * @param listener the listener to notify
59 + */
60 + public void addLinkListener(PcepLinkListener listener);
61 +
62 + /**
63 + * Unregister a link listener.
64 + *
65 + * @param listener the listener to unregister
66 + */
67 + public void removeLinkListener(PcepLinkListener listener);
68 +
69 + /**
70 + * Register a listener for meta events that occur to PCEP tunnel.
71 + *
72 + * @param listener the listener to notify
73 + */
74 + public void addTunnelListener(PcepTunnelListener listener);
75 +
76 + /**
77 + * Unregister a tunnel listener.
78 + *
79 + * @param listener the listener to unregister
80 + */
81 + public void removeTunnelListener(PcepTunnelListener listener);
82 +
83 + /**
84 + * Setup a tunnel through pcep controller.
85 + *
86 + * @param srcDid src deviceId of tunnel
87 + * @param dstDid dst deviceId of tunnel
88 + * @param srcPort src port
89 + * @param dstPort dst port
90 + * @param bandwidth andwidth of tunnel
91 + * @param name tunnel name
92 + * @return pcep tunnel
93 + */
94 + public PcepTunnel applyTunnel(DeviceId srcDid, DeviceId dstDid,
95 + long srcPort, long dstPort, long bandwidth,
96 + String name);
97 +
98 + /**
99 + * Delete tunnel by id.
100 + *
101 + * @param id pcep tunnel id.
102 + * @return true or false
103 + */
104 + public Boolean deleteTunnel(String id);
105 +
106 + /**
107 + * Update tunnel bandwidth by tunnel id.
108 + *
109 + * @param id tunnel id
110 + * @param bandwidth bandwidth of a tunnel
111 + * @return true or false
112 + */
113 + public Boolean updateTunnelBandwidth(String id, long bandwidth);
114 +
115 +}
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.pcep.api;
17 +
18 +import java.net.URI;
19 +import java.net.URISyntaxException;
20 +
21 +import org.onosproject.pcep.tools.PcepTools;
22 +
23 +/**
24 + * The class representing a network switch PCEPDid. This class is immutable.
25 + */
26 +public final class PcepDpid {
27 +
28 + private static final String SCHEME = "pcep";
29 + private static final long UNKNOWN = 0;
30 + private long nodeId;
31 +
32 + /**
33 + * Default constructor.
34 + */
35 + public PcepDpid() {
36 + this.nodeId = PcepDpid.UNKNOWN;
37 + }
38 +
39 + /**
40 + * Constructor from a long value.
41 + *
42 + * @param value long value for construct
43 + */
44 + public PcepDpid(long value) {
45 + this.nodeId = value;
46 + }
47 +
48 + /**
49 + * Constructor from a String.
50 + *
51 + * @param value string value for construct
52 + */
53 + public PcepDpid(String value) {
54 + this.nodeId = Long.parseLong(value, 16);
55 + }
56 +
57 + /**
58 + * Produces device URI from the given DPID.
59 + *
60 + * @param dpid device dpid
61 + * @return device URI
62 + */
63 + public static URI uri(PcepDpid dpid) {
64 + return uri(dpid.nodeId);
65 + }
66 +
67 + /**
68 + * Produces device long from the given string which comes from the uri
69 + * method.
70 + *
71 + * @param value string value which produced by uri method.
72 + * @return a long value.
73 + */
74 + public static long toLong(String value) {
75 + return PcepTools.ipToLong(value.replace(SCHEME, ""));
76 + }
77 +
78 + /**
79 + * Produces device URI from the given DPID long.
80 + *
81 + * @param value device dpid as long
82 + * @return device URI
83 + */
84 + public static URI uri(long value) {
85 + try {
86 + return new URI(SCHEME, PcepTools.longToIp(value), null);
87 + } catch (URISyntaxException e) {
88 + return null;
89 + }
90 + }
91 +
92 + /**
93 + * Return a device id with the form of long.
94 + *
95 + * @return long value
96 + */
97 + public long value() {
98 + return this.nodeId;
99 + }
100 +
101 +}
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.pcep.api;
17 +
18 +/**
19 + * Description of a pcep tunnel hop node.a hop list consists of a number of hop
20 + * node.
21 + */
22 +public class PcepHopNodeDescription {
23 + private PcepDpid deviceId;
24 + private long portNum;
25 +
26 + /**
27 + * Get the pcepdpid of a node.
28 + *
29 + * @return device pcepdpid.
30 + */
31 + public PcepDpid getDeviceId() {
32 + return deviceId;
33 + }
34 +
35 + /**
36 + * Set the pcepdpid of a node.
37 + *
38 + * @param deviceId pcep dpid of a node.
39 + */
40 + public void setDeviceId(PcepDpid deviceId) {
41 + this.deviceId = deviceId;
42 + }
43 +
44 + /**
45 + * Get the port number of a node.
46 + *
47 + * @return port number.
48 + */
49 + public long getPortNum() {
50 + return portNum;
51 + }
52 +
53 + /**
54 + * Set the port number of a node.
55 + *
56 + * @param portNum port number of a node.
57 + */
58 + public void setPortNum(long portNum) {
59 + this.portNum = portNum;
60 + }
61 +
62 +}
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.pcep.api;
17 +
18 +/**
19 + * Abstraction of a huawei network infrastructure link.
20 + */
21 +public interface PcepLink extends PcepOperator {
22 +
23 + public enum SubType {
24 + /**
25 + * Optical Transmission Section Link.
26 + */
27 + OTS,
28 +
29 + /**
30 + * Optical Physical Section Link.
31 + */
32 + OPS,
33 +
34 + /**
35 + * User-to-Network Interface Link.
36 + */
37 + UNI,
38 +
39 + /**
40 + * Optical channel Data Unit-k link.
41 + */
42 + ODUk,
43 +
44 + /**
45 + * Optical Transport Network link.
46 + */
47 + OTU,
48 + }
49 +
50 +
51 +
52 + /**
53 + * Get the link endpoint port type.
54 + *
55 + * @return endpoint port type
56 + */
57 + public String portType();
58 +
59 + /**
60 + * Get the link sub type,OTS,OPS,PKT_OPTICAL or ODUK.
61 + *
62 + * @return link subType
63 + */
64 +
65 + public SubType linkSubType();
66 +
67 + /**
68 + * Get the link state, up or down.
69 + *
70 + * @return link state
71 + */
72 + public String linkState();
73 +
74 + /**
75 + * Get the distance of a link.
76 + *
77 + * @return distance
78 + */
79 + public int linkDistance();
80 +
81 + /**
82 + * Get the capacity type of a link,1: WAVELENGTHNUM, 2:SLOTNUM, 3,
83 + * BANDWIDTH.
84 + *
85 + * @return capacity type
86 + */
87 + public String linkCapacityType();
88 +
89 + /**
90 + * Get the available capacity value ,such as available bandwidth.
91 + *
92 + * @return availValue
93 + */
94 + public int linkAvailValue();
95 +
96 + /**
97 + * Get the max capacity value ,such as max bandwidth.
98 + *
99 + * @return maxValue
100 + */
101 + public int linkMaxValue();
102 +
103 + /**
104 + * Get the source device did of a link.
105 + *
106 + * @return source did
107 + */
108 + public PcepDpid linkSrcDeviceID();
109 +
110 + /**
111 + * Get the destination device did of a link.
112 + *
113 + * @return destination did
114 + */
115 + public PcepDpid linkDstDeviceId();
116 +
117 + /**
118 + * Get the source port number of a link,the port consists of shelf id, sub
119 + * card id, board id, and port id of a Huawei Device.
120 + *
121 + * @return port number
122 + */
123 + public long linkSrcPort();
124 +
125 + /**
126 + * Get the destination port number of a link,the port consists of shelf id,
127 + * sub card id, board id, and port id of a Huawei Device.
128 + *
129 + * @return port number
130 + */
131 + public long linkDstPort();
132 +
133 +}
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.pcep.api;
17 +
18 +/**
19 + * Allows for providers interested in Link events to be notified.
20 + */
21 +public interface PcepLinkListener {
22 +
23 + /**
24 + * Notify that get a packet of link from network and need do some
25 + * processing.
26 + *
27 + * @param link pcep link
28 + */
29 + public void handlePCEPlink(PcepLink link);
30 +}
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.pcep.api;
17 +
18 +/**
19 + * A interface defined operator type, and provide a method to get the operator
20 + * type.
21 + *
22 + */
23 +public interface PcepOperator {
24 +
25 + public enum OperationType {
26 +
27 + ADD, UPDATE, DELETE,
28 + }
29 +
30 + /**
31 + * Get operate type of a event,such as device add ,device update.
32 + *
33 + * @return operation type.
34 + */
35 + public OperationType getOperationType();
36 +}
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.pcep.api;
17 +
18 +/*
19 + * Represent to provider facing side of a switch
20 + */
21 +public interface PcepSwitch extends PcepOperator {
22 +
23 + public static enum SubDeviceType {
24 + /* optical device */
25 + ROADM,
26 +
27 + /* electronic device */
28 + OTN,
29 +
30 + /* router */
31 + ROUTER,
32 +
33 + /* unkown type */
34 + UNKNOW,
35 + }
36 +
37 + /**
38 + * Gets a string version of the ID for this switch.
39 + * @return string version of the ID
40 + */
41 + public String getStringId();
42 +
43 + /**
44 + * Gets the datapathId of the switch.
45 + * @return the switch dpid in long format
46 + */
47 + public long getId();
48 +
49 + public long getNeId();
50 +
51 + /**
52 + * Gets the sub type of the device.
53 + * @return the sub type
54 + */
55 + public SubDeviceType getDeviceSubType();
56 +
57 + /**
58 + * fetch the manufacturer description.
59 + * @return the description
60 + */
61 + public String manufacturerDescription();
62 +
63 + /**
64 + * fetch the datapath description.
65 + * @return the description
66 + */
67 + public String datapathDescription();
68 +
69 + /**
70 + * fetch the hardware description.
71 + * @return the description
72 + */
73 + public String hardwareDescription();
74 +
75 + /**
76 + * fetch the software description.
77 + * @return the description
78 + */
79 + public String softwareDescription();
80 +
81 + /**
82 + * fetch the serial number.
83 + * @return the serial
84 + */
85 + public String serialNumber();
86 +
87 + /**
88 + * Indicates if this switch is optical.
89 + * @return true if optical
90 + */
91 + public boolean isOptical();
92 +}
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.pcep.api;
17 +
18 +/**
19 + * Notifies providers about switch in events.
20 + */
21 +public interface PcepSwitchListener {
22 +
23 + /**
24 + * Notify that the switch was added.
25 + *
26 + * @param dpid the switch where the event occurred
27 + */
28 + public void switchAdded(PcepDpid dpid);
29 +
30 + /**
31 + * Notify that the switch was removed.
32 + *
33 + * @param dpid the switch where the event occurred.
34 + */
35 + public void switchRemoved(PcepDpid dpid);
36 +
37 + /**
38 + * Notify that the switch has changed in some way.
39 + *
40 + * @param dpid the switch that changed
41 + */
42 + public void switchChanged(PcepDpid dpid);
43 +
44 +}
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +package org.onosproject.pcep.api;
18 +
19 +import java.util.List;
20 +
21 +/**
22 + * Abstraction of a generalized PCEP Tunnel entity (bandwidth pipe) for
23 + * L2 networks or L1/L0 networks, representation of e.g., VLAN, L1 ODUk
24 + * connection, WDM OCH, etc..
25 + */
26 +public interface PcepTunnel extends PcepOperator {
27 +
28 + /**
29 + * Describe the type of a tunnel.
30 + */
31 + public static enum Type {
32 +
33 + /**
34 + * Signifies that this is a L0 OCH tunnel.
35 + */
36 + OCH,
37 +
38 + /**
39 + * Signifies that this is a L1 OTN tunnel.
40 + */
41 + OTN,
42 +
43 + /**
44 + * Signifies that this is a L2 tunnel.
45 + */
46 + UNI,
47 + }
48 +
49 + /**
50 + * The ability of a tunnel.
51 + */
52 + public static enum Ability {
53 + /**
54 + * no protected tunnel,if the tunnel is broken ,then the user is out of
55 + * service.
56 + */
57 + NOPROTECTED,
58 +
59 + /**
60 + * tunnel with rerouter ability.if a tunnel is broken, the tunnel will
61 + * try to find another path to provider service.
62 + */
63 + SILVER,
64 +
65 + /**
66 + * tunnel with 1 + 1 rerouter ability.if a tunnel is broken, there'll be
67 + * another tunnel providing service at once.
68 + */
69 + DIAMOND
70 + }
71 +
72 + public static enum PATHTYPE {
73 +
74 + /**
75 + * the preferred path.
76 + */
77 + FIRST,
78 +
79 + /**
80 + * the alternate path.
81 + */
82 + SECOND
83 + }
84 +
85 + /**
86 + * Get the type of a tunnel.
87 + *
88 + * @return tunnel type
89 + */
90 + public Type type();
91 +
92 + /**
93 + * Get the name of a tunnel.
94 + *
95 + * @return tunnel name
96 + */
97 + public String name();
98 +
99 + /**
100 + * Get the device id of destination endpoint of a tunnel.
101 + *
102 + * @return device id
103 + */
104 + public PcepDpid srcDeviceID();
105 +
106 + /**
107 + * Get the device id of source endpoint of a tunnel.
108 + *
109 + * @return device id
110 + */
111 + public PcepDpid dstDeviceId();
112 +
113 + /**
114 + * Get source port of a tunnel.
115 + *
116 + * @return port number
117 + */
118 + public long srcPort();
119 +
120 + /**
121 + * Get destination port of a tunnel.
122 + *
123 + * @return port number
124 + */
125 + public long dstPort();
126 +
127 + /**
128 + * Get the bandwidth of a tunnel.
129 + *
130 + * @return bandwidth
131 + */
132 + public long bandWidth();
133 +
134 + /**
135 + * Get the tunnel id.
136 + *
137 + * @return id of the PCEP tunnel
138 + */
139 + public long id();
140 +
141 + /**
142 + * Get the detail hop list of a tunnel.
143 + *
144 + * @return hop list
145 + */
146 + public List<PcepHopNodeDescription> getHopList();
147 +
148 + /**
149 + * Get the instance of a pcep tunnel,a instance is used to mark the times of a tunnel created.
150 + * instance and id identify a tunnel together.
151 + *
152 + * @return the instance of a tunnel.
153 + */
154 + public int getInstance();
155 +
156 + /**
157 + * Get the ability of a tunnel.NOPROTECTED,SILVER,or DIAMOND.
158 + *
159 + * @return ability of the tunenl
160 + */
161 + public Ability getSla();
162 +
163 + /**
164 + * Get the path type of a path if the tunnel's ability is diamond .
165 + *
166 + * @return the type of a path, the preferred or alternate.
167 + */
168 + public PATHTYPE getPathType();
169 +
170 + /**
171 + * Get the under lay tunnel id of VLAN tunnel.
172 + *
173 + * @return the tunnel id of a OCH tunnel under lay of a VLAN tunnel.
174 + */
175 + public long underLayTunnelId();
176 +
177 +}
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.pcep.api;
17 +
18 +/**
19 + * Allows for providers interested in tunnel events to be notified.
20 + */
21 +public interface PcepTunnelListener {
22 +
23 + /**
24 + * Notify that get a packet of tunnel from network and need do some
25 + * processing.
26 + *
27 + * @param tunnel a pceptunnel.
28 + */
29 + public void handlePCEPTunnel(PcepTunnel tunnel);
30 +
31 +}
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +/**
18 + * PCEP controller API.
19 + */
20 +package org.onosproject.pcep.api;
...\ No newline at end of file ...\ No newline at end of file
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.pcep.tools;
17 +
18 +import javax.xml.bind.DatatypeConverter;
19 +
20 +/**
21 + * tools fo pcep app.
22 + */
23 +public abstract class PcepTools {
24 +
25 + private PcepTools() {
26 +
27 + }
28 +
29 + /**
30 + * Converts decimal byte array to a hex string.
31 + *
32 + * @param byteArray byte array
33 + * @return a hex string
34 + */
35 + public static String toHexString(byte[] byteArray) {
36 + return DatatypeConverter.printHexBinary(byteArray);
37 + }
38 +
39 + /**
40 + * Converts a hex string to a decimal byte array.
41 + *
42 + * @param hexString a hex string
43 + * @return byte array
44 + */
45 + public static byte[] toByteArray(String hexString) {
46 + return DatatypeConverter.parseHexBinary(hexString);
47 + }
48 +
49 + /**
50 + * Converts a byte array to a decimal string.
51 + *
52 + * @param bytes a byte array
53 + * @return a decimal string
54 + */
55 + public static String toDecimalString(byte[] bytes) {
56 + String str = "";
57 + for (int i = 0; i < bytes.length; i++) {
58 + str += String.valueOf(bytes[i]);
59 + }
60 + return str;
61 + }
62 +
63 + /**
64 + * convert a string to the form of ip address.
65 + *
66 + * @param str a string
67 + * @return a string with ip format
68 + */
69 + public static String stringToIp(String str) {
70 + long ipInt = Long.parseLong(str, 16);
71 + return longToIp(ipInt);
72 + }
73 +
74 + /**
75 + * convert a long to ip format.
76 + *
77 + * @param ipLong a decimal number.
78 + * @return a ip format string
79 + */
80 + public static String longToIp(long ipLong) {
81 + StringBuilder sb = new StringBuilder();
82 + sb.append((ipLong >> 24) & 0xFF).append(".");
83 + sb.append((ipLong >> 16) & 0xFF).append(".");
84 + sb.append((ipLong >> 8) & 0xFF).append(".");
85 + sb.append(ipLong & 0xFF);
86 + return sb.toString();
87 + }
88 +
89 + /**
90 + * convert a string with ip format to a long.
91 + *
92 + * @param strIp a string with ip format
93 + * @return a long number
94 + */
95 + public static long ipToLong(String strIp) {
96 + long[] ip = new long[4];
97 + int position1 = strIp.indexOf(".");
98 + int position2 = strIp.indexOf(".", position1 + 1);
99 + int position3 = strIp.indexOf(".", position2 + 1);
100 + ip[0] = Long.parseLong(strIp.substring(0, position1));
101 + ip[1] = Long.parseLong(strIp.substring(position1 + 1, position2));
102 + ip[2] = Long.parseLong(strIp.substring(position2 + 1, position3));
103 + ip[3] = Long.parseLong(strIp.substring(position3 + 1));
104 + return (ip[0] << 24) + (ip[1] << 16) + (ip[2] << 8) + ip[3];
105 + }
106 +
107 + /**
108 + * get a integer value from a cut string.
109 + *
110 + * @param str a whole string
111 + * @param base cut the string from this index
112 + * @param offset the offset when execute the cut
113 + * @return a integer value
114 + */
115 + public static int tranferHexStringToInt(String str, int base, int offset) {
116 + return Integer.parseInt(str.substring(base, offset), 16);
117 +
118 + }
119 +}
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +/**
17 + * tools for pcep app.
18 + */
19 +package org.onosproject.pcep.tools;
...\ No newline at end of file ...\ No newline at end of file
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
49 <module>segmentrouting</module> 49 <module>segmentrouting</module>
50 <module>cordfabric</module> 50 <module>cordfabric</module>
51 <module>xos-integration</module> 51 <module>xos-integration</module>
52 + <module>pcep-api</module>
52 </modules> 53 </modules>
53 54
54 <properties> 55 <properties>
......
...@@ -387,6 +387,11 @@ ...@@ -387,6 +387,11 @@
387 387
388 <dependency> 388 <dependency>
389 <groupId>org.onosproject</groupId> 389 <groupId>org.onosproject</groupId>
390 + <artifactId>onos-app-pcep-api</artifactId>
391 + <version>${project.version}</version>
392 + </dependency>
393 + <dependency>
394 + <groupId>org.onosproject</groupId>
390 <artifactId>onlab-thirdparty</artifactId> 395 <artifactId>onlab-thirdparty</artifactId>
391 <version>${project.version}</version> 396 <version>${project.version}</version>
392 </dependency> 397 </dependency>
......
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!--
3 + ~ Copyright 2015 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 +<app name="org.onosproject.pcep" origin="ON.Lab" version="${project.version}"
18 + featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
19 + features="${project.artifactId}">
20 + <description>${project.description}</description>
21 + <artifact>mvn:${project.groupId}/onos-app-pcep-api/${project.version}</artifact>
22 + <artifact>mvn:${project.groupId}/onos-pcep-provider-topology/${project.version}</artifact>
23 + <artifact>mvn:${project.groupId}/onos-pcep-provider-tunnel/${project.version}</artifact>
24 +</app>
1 +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2 +<!--
3 + ~ Copyright 2015 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 +<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
18 + <repository>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</repository>
19 + <feature name="${project.artifactId}" version="${project.version}"
20 + description="${project.description}">
21 + <feature>onos-api</feature>
22 + <bundle>mvn:${project.groupId}/onos-app-pcep-api/${project.version}</bundle>
23 + <bundle>mvn:${project.groupId}/onos-pcep-provider-topology/${project.version}</bundle>
24 + <bundle>mvn:${project.groupId}/onos-pcep-provider-tunnel/${project.version}</bundle>
25 + </feature>
26 +</features>
1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3 + <modelVersion>4.0.0</modelVersion>
4 + <parent>
5 + <groupId>org.onosproject</groupId>
6 + <artifactId>onos-pcep-providers</artifactId>
7 + <version>1.2.0-SNAPSHOT</version>
8 + <relativePath>../pom.xml</relativePath>
9 + </parent>
10 + <artifactId>onos-pcep</artifactId>
11 + <packaging>pom</packaging>
12 + <dependencies>
13 + <dependency>
14 + <groupId>org.onosproject</groupId>
15 + <artifactId>onos-app-pcep-api</artifactId>
16 + </dependency>
17 + <dependency>
18 + <groupId>org.onosproject</groupId>
19 + <artifactId>onos-pcep-provider-topology</artifactId>
20 + <version>${project.version}</version>
21 + </dependency>
22 + <dependency>
23 + <groupId>org.onosproject</groupId>
24 + <artifactId>onos-pcep-provider-tunnel</artifactId>
25 + <version>${project.version}</version>
26 + </dependency>
27 +
28 + </dependencies>
29 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2 + <modelVersion>4.0.0</modelVersion>
3 + <parent>
4 + <groupId>org.onosproject</groupId>
5 + <artifactId>onos-providers</artifactId>
6 + <version>1.2.0-SNAPSHOT</version>
7 + <relativePath>../pom.xml</relativePath>
8 + </parent>
9 + <artifactId>onos-pcep-providers</artifactId>
10 + <packaging>pom</packaging>
11 + <modules>
12 + <module>topology</module>
13 + <module>tunnel</module>
14 + <module>app</module>
15 + </modules>
16 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2 + <modelVersion>4.0.0</modelVersion>
3 + <parent>
4 + <groupId>org.onosproject</groupId>
5 + <artifactId>onos-pcep-providers</artifactId>
6 + <version>1.2.0-SNAPSHOT</version>
7 + <relativePath>../pom.xml</relativePath>
8 + </parent>
9 + <artifactId>onos-pcep-provider-topology</artifactId>
10 + <packaging>bundle</packaging>
11 + <dependencies>
12 + <dependency>
13 + <groupId>org.onosproject</groupId>
14 + <artifactId>onos-app-pcep-api</artifactId>
15 + </dependency>
16 + </dependencies>
17 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +/**
17 + *Provider that uses PCEP controller as a means of infrastructure topology discovery.
18 + */
19 +package org.onosproject.provider.pcep.topology.impl;
...\ No newline at end of file ...\ No newline at end of file
1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3 + <modelVersion>4.0.0</modelVersion>
4 + <parent>
5 + <groupId>org.onosproject</groupId>
6 + <artifactId>onos-pcep-providers</artifactId>
7 + <version>1.2.0-SNAPSHOT</version>
8 + <relativePath>../pom.xml</relativePath>
9 + </parent>
10 + <artifactId>onos-pcep-provider-tunnel</artifactId>
11 + <packaging>bundle</packaging>
12 +
13 + <dependencies>
14 + <dependency>
15 + <groupId>org.onosproject</groupId>
16 + <artifactId>onos-app-pcep-api</artifactId>
17 + </dependency>
18 + </dependencies>
19 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +/**
17 + *Provider that uses PCEP controller as a means of infrastructure tunnel discovery.
18 + */
19 +package org.onosproject.provider.pcep.tunnel.impl;
...\ No newline at end of file ...\ No newline at end of file
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
38 <module>netconf</module> 38 <module>netconf</module>
39 <module>null</module> 39 <module>null</module>
40 <module>tunnel</module> 40 <module>tunnel</module>
41 + <module>pcep</module>
41 </modules> 42 </modules>
42 43
43 <dependencies> 44 <dependencies>
......