Committed by
Yuta HIGUCHI
Power config API (ONOS-2866).
Change-Id: I50a405d63f95fa8024585c71885ac79dca7e7c78
Showing
3 changed files
with
87 additions
and
6 deletions
1 | +/* | ||
2 | + * Copyright 2016 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.net; | ||
17 | + | ||
18 | +/** | ||
19 | + * Represents a direction. Typically applied to links or ports. | ||
20 | + */ | ||
21 | +public enum Direction { | ||
22 | + ALL, | ||
23 | + INGRESS, | ||
24 | + EGRESS | ||
25 | +} |
1 | +/* | ||
2 | + * Copyright 2016 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.net.behaviour; | ||
17 | + | ||
18 | +import org.onosproject.net.PortNumber; | ||
19 | +import org.onosproject.net.driver.HandlerBehaviour; | ||
20 | + | ||
21 | +import java.util.Optional; | ||
22 | + | ||
23 | +/** | ||
24 | + * Behavior for handling port power configurations. | ||
25 | + * | ||
26 | + * Power operations act on a network port and a component thereof. | ||
27 | + * Supported components are either the full directed port ({@link org.onosproject.net.Direction}) | ||
28 | + * or a wavelength on a port ({@link org.onosproject.net.OchSignal}). | ||
29 | + * | ||
30 | + * Power levels are specified with a long and unit .01 dBm. | ||
31 | + */ | ||
32 | +public interface PowerConfig<T> extends HandlerBehaviour { | ||
33 | + | ||
34 | + /** | ||
35 | + * Get the target power on the component. | ||
36 | + * | ||
37 | + * @param port the port | ||
38 | + * @param component the port component | ||
39 | + * @return target power in .01 dBm | ||
40 | + */ | ||
41 | + Optional<Long> getTargetPower(PortNumber port, T component); | ||
42 | + | ||
43 | + /** | ||
44 | + * Set the target power on the component. | ||
45 | + * | ||
46 | + * | ||
47 | + * @param port the port | ||
48 | + * @param component the port component | ||
49 | + * @param power target power in .01 dBm | ||
50 | + */ | ||
51 | + void setTargetPower(PortNumber port, T component, long power); | ||
52 | + | ||
53 | + /** | ||
54 | + * Get the current power on the component. | ||
55 | + * | ||
56 | + * @param port the port | ||
57 | + * @param component the port component | ||
58 | + * @return power power in .01 dBm | ||
59 | + */ | ||
60 | + Optional<Long> currentPower(PortNumber port, T component); | ||
61 | +} |
... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.rest.resources; | 16 | package org.onosproject.rest.resources; |
17 | 17 | ||
18 | +import org.onosproject.net.Direction; | ||
18 | import org.onosproject.net.ConnectPoint; | 19 | import org.onosproject.net.ConnectPoint; |
19 | import org.onosproject.net.DeviceId; | 20 | import org.onosproject.net.DeviceId; |
20 | import org.onosproject.net.Link; | 21 | import org.onosproject.net.Link; |
... | @@ -35,12 +36,6 @@ import static org.onosproject.net.PortNumber.portNumber; | ... | @@ -35,12 +36,6 @@ import static org.onosproject.net.PortNumber.portNumber; |
35 | @Path("links") | 36 | @Path("links") |
36 | public class LinksWebResource extends AbstractWebResource { | 37 | public class LinksWebResource extends AbstractWebResource { |
37 | 38 | ||
38 | - enum Direction { | ||
39 | - ALL, | ||
40 | - INGRESS, | ||
41 | - EGRESS | ||
42 | - } | ||
43 | - | ||
44 | /** | 39 | /** |
45 | * Get infrastructure links. | 40 | * Get infrastructure links. |
46 | * Returns array of all links, or links for the specified device or port. | 41 | * Returns array of all links, or links for the specified device or port. | ... | ... |
-
Please register or login to post a comment