Committed by
Gerrit Code Review
[ONOS-3498] Add skeleton codes for control plane management;
Change-Id: I741d2b7ed67f35179613c274b9efe375997213eb
Showing
9 changed files
with
326 additions
and
0 deletions
apps/cpman/pom.xml
0 → 100644
| 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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 18 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 19 | + <modelVersion>4.0.0</modelVersion> | ||
| 20 | + <parent> | ||
| 21 | + <groupId>org.onosproject</groupId> | ||
| 22 | + <artifactId>onos-apps</artifactId> | ||
| 23 | + <version>1.4.0-SNAPSHOT</version> | ||
| 24 | + <relativePath>../pom.xml</relativePath> | ||
| 25 | + </parent> | ||
| 26 | + | ||
| 27 | + <artifactId>onos-app-cpman</artifactId> | ||
| 28 | + <packaging>bundle</packaging> | ||
| 29 | + | ||
| 30 | + <description>Control Plane Management Application</description> | ||
| 31 | + | ||
| 32 | + <dependencies> | ||
| 33 | + <dependency> | ||
| 34 | + <groupId>org.onosproject</groupId> | ||
| 35 | + <artifactId>onos-api</artifactId> | ||
| 36 | + <version>1.4.0-SNAPSHOT</version> | ||
| 37 | + </dependency> | ||
| 38 | + </dependencies> | ||
| 39 | +</project> |
| 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.cpman; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * Abstracted Control Message Type. | ||
| 20 | + */ | ||
| 21 | +public enum ControlMessageType { | ||
| 22 | + | ||
| 23 | + /** Mapped to PACKET-IN message of OpenFlow. */ | ||
| 24 | + INBOUND_PACKET, | ||
| 25 | + | ||
| 26 | + /** Mapped to PACKET-OUT message of OpenFlow. */ | ||
| 27 | + OUTBOUND_PACKET, | ||
| 28 | + | ||
| 29 | + /** Mapped to FLOW-MOD message of OpenFlow. */ | ||
| 30 | + FLOW_MOD_PACKET, | ||
| 31 | + | ||
| 32 | + /** Mapped to FLOW-REMOVED message of OpenFlow. */ | ||
| 33 | + FLOW_REMOVED_PACKET, | ||
| 34 | + | ||
| 35 | + /** Mapped to STATS-REQUEST message of OpenFlow. */ | ||
| 36 | + REQUEST_PACKET, | ||
| 37 | + | ||
| 38 | + /** Mapped to STATS-REPLY message of OpenFlow. */ | ||
| 39 | + REPLY_PACKET, | ||
| 40 | + | ||
| 41 | + /** All message types. */ | ||
| 42 | + ALL | ||
| 43 | +} |
| 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.cpman; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * A set of metric type used in control plane. | ||
| 20 | + */ | ||
| 21 | +public enum ControlMetricType { | ||
| 22 | + | ||
| 23 | + /** Racket Rate of Control Message. */ | ||
| 24 | + PacketRate, | ||
| 25 | + | ||
| 26 | + /** Byte Rate of Control Message. */ | ||
| 27 | + ByteRate, | ||
| 28 | + | ||
| 29 | + /** Cpu Utilization. */ | ||
| 30 | + CpuInfo, | ||
| 31 | + | ||
| 32 | + /** Memory Utilization. */ | ||
| 33 | + MemoryInfo | ||
| 34 | +} |
| 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.cpman; | ||
| 17 | + | ||
| 18 | +import org.onosproject.net.statistic.Load; | ||
| 19 | + | ||
| 20 | +import java.util.concurrent.TimeUnit; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Data repository for control plane load information. | ||
| 24 | + */ | ||
| 25 | +public interface ControlPlaneLoad extends Load { | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * Obtain the average of the specified time duration. | ||
| 29 | + * | ||
| 30 | + * @param duration time duration | ||
| 31 | + * @param unit time unit | ||
| 32 | + * @return average control plane metric value | ||
| 33 | + */ | ||
| 34 | + long average(int duration, TimeUnit unit); | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * Obtain the average of all time duration. | ||
| 38 | + * | ||
| 39 | + * @return average control plane metric value | ||
| 40 | + */ | ||
| 41 | + long average(); | ||
| 42 | +} |
| 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.cpman; | ||
| 17 | + | ||
| 18 | +import com.sun.jndi.toolkit.ctx.ComponentContext; | ||
| 19 | +import org.apache.felix.scr.annotations.Activate; | ||
| 20 | +import org.apache.felix.scr.annotations.Deactivate; | ||
| 21 | +import org.apache.felix.scr.annotations.Modified; | ||
| 22 | +import org.slf4j.Logger; | ||
| 23 | + | ||
| 24 | +import static org.slf4j.LoggerFactory.getLogger; | ||
| 25 | + | ||
| 26 | +/** | ||
| 27 | + * Control plane management application. | ||
| 28 | + */ | ||
| 29 | +public class ControlPlaneManager { | ||
| 30 | + | ||
| 31 | + private final Logger log = getLogger(getClass()); | ||
| 32 | + | ||
| 33 | + @Activate | ||
| 34 | + public void activate(ComponentContext context) { | ||
| 35 | + | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @Deactivate | ||
| 39 | + public void deactivate() { | ||
| 40 | + | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @Modified | ||
| 44 | + public void modified(ComponentContext context) { | ||
| 45 | + | ||
| 46 | + } | ||
| 47 | +} | ||
| ... | \ 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.cpman; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * Include various control plane metrics. | ||
| 20 | + */ | ||
| 21 | +public class ControlPlaneMetric { | ||
| 22 | + | ||
| 23 | + private ControlMetricType metricType; | ||
| 24 | + private long metricValue; | ||
| 25 | + | ||
| 26 | + ControlMetricType metricType() { | ||
| 27 | + return metricType; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + void setMetricType(ControlMetricType metricType) { | ||
| 31 | + this.metricType = metricType; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + long metricValue() { | ||
| 35 | + return metricValue; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + void setMetricValue(long metricValue) { | ||
| 39 | + this.metricValue = metricValue; | ||
| 40 | + } | ||
| 41 | +} |
| 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.cpman; | ||
| 17 | + | ||
| 18 | +import org.onosproject.cluster.NodeId; | ||
| 19 | +import org.onosproject.net.DeviceId; | ||
| 20 | + | ||
| 21 | +import java.util.Optional; | ||
| 22 | +import java.util.concurrent.TimeUnit; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Control Plane Statistics Service Interface. | ||
| 26 | + */ | ||
| 27 | +public interface ControlPlaneStatsService { | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * Add a new control plane metric value with a certain update interval. | ||
| 31 | + * | ||
| 32 | + * @param cpm control plane metric (e.g., control message rate, cpu, memory, etc.) | ||
| 33 | + * @param updateInterval value update interval (time unit will be in minute) | ||
| 34 | + */ | ||
| 35 | + void updateMetric(ControlPlaneMetric cpm, int updateInterval); | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * Obtain the control plane load of a specific device. | ||
| 39 | + * | ||
| 40 | + * @param nodeId node id {@link org.onosproject.cluster.NodeId} | ||
| 41 | + * @param type control metric type | ||
| 42 | + * @param deviceId device id {@link org.onosproject.net.DeviceId} | ||
| 43 | + * @return control plane load | ||
| 44 | + */ | ||
| 45 | + ControlPlaneLoad getLoad(NodeId nodeId, ControlMetricType type, Optional<DeviceId> deviceId); | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * Obtain the control plane load of a specific device with a specific time duration. | ||
| 49 | + * | ||
| 50 | + * @param nodeId node id {@link org.onosproject.cluster.NodeId} | ||
| 51 | + * @param type control metric type | ||
| 52 | + * @param duration time duration | ||
| 53 | + * @param unit time unit | ||
| 54 | + * @param deviceId device id {@link org.onosproject.net.Device} | ||
| 55 | + * @return control plane load | ||
| 56 | + */ | ||
| 57 | + ControlPlaneLoad getLoad(NodeId nodeId, ControlMetricType type, Optional<DeviceId> deviceId, | ||
| 58 | + int duration, TimeUnit unit); | ||
| 59 | +} | ||
| ... | \ 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 | +/** | ||
| 18 | + * Application for control plane management. | ||
| 19 | + */ | ||
| 20 | +package org.onosproject.cpman; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -60,6 +60,7 @@ | ... | @@ -60,6 +60,7 @@ |
| 60 | <module>mlb</module> | 60 | <module>mlb</module> |
| 61 | <module>openstackswitching</module> | 61 | <module>openstackswitching</module> |
| 62 | <module>pathpainter</module> | 62 | <module>pathpainter</module> |
| 63 | + <module>cpman</module> | ||
| 63 | </modules> | 64 | </modules> |
| 64 | 65 | ||
| 65 | <properties> | 66 | <properties> | ... | ... |
-
Please register or login to post a comment