tom

Sketching cluster related stuff with Madan..

1 +package org.onlab.onos.cluster;
2 +
3 +import org.onlab.onos.event.AbstractEvent;
4 +
5 +/**
6 + * Describes cluster-related event.
7 + */
8 +public class ClusterEvent extends AbstractEvent<ClusterEvent.Type, ControllerInstance> {
9 +
10 + /**
11 + * Type of device events.
12 + */
13 + public enum Type {
14 + /**
15 + * Signifies that a new cluster instance has been administratively added.
16 + */
17 + INSTANCE_ADDED,
18 +
19 + /**
20 + * Signifies that a cluster instance has been administratively removed.
21 + */
22 + INSTANCE_REMOVED,
23 +
24 + /**
25 + * Signifies that a cluster instance became active.
26 + */
27 + INSTANCE_ACTIVE,
28 +
29 + /**
30 + * Signifies that a cluster instance became inactive.
31 + */
32 + INSTANCE_INACTIVE
33 + }
34 + // TODO: do we need to fix the verv/adjective mix? discuss
35 +
36 + /**
37 + * Creates an event of a given type and for the specified instance and the
38 + * current time.
39 + *
40 + * @param type cluster event type
41 + * @param instance cluster device subject
42 + */
43 + public ClusterEvent(Type type, ControllerInstance instance) {
44 + super(type, instance);
45 + }
46 +
47 + /**
48 + * Creates an event of a given type and for the specified device and time.
49 + *
50 + * @param type device event type
51 + * @param instance event device subject
52 + * @param time occurrence time
53 + */
54 + public ClusterEvent(Type type, ControllerInstance instance, long time) {
55 + super(type, instance, time);
56 + }
57 +
58 +}
1 +package org.onlab.onos.cluster;
2 +
3 +import java.util.Set;
4 +
5 +/**
6 + * Service for obtaining information about the individual instances within
7 + * the controller cluster.
8 + */
9 +public interface ClusterService {
10 +
11 + /**
12 + * Returns the set of current cluster members.
13 + *
14 + * @return set of cluster members
15 + */
16 + Set<ControllerInstance> getInstances();
17 +
18 + /**
19 + * Returns the availability state of the specified controller instance.
20 + *
21 + * @return availability state
22 + */
23 + ControllerInstance.State getState(ControllerInstance instance);
24 + // TODO: determine if this would be better attached to ControllerInstance directly
25 +
26 +
27 + // addListener, removeListener
28 +
29 +}
1 +package org.onlab.onos.cluster;
2 +
3 +import org.onlab.packet.IpAddress;
4 +
5 +/**
6 + * Represents a controller instance as a member in a cluster.
7 + */
8 +public interface ControllerInstance {
9 +
10 + /** Represents the operational state of the instance. */
11 + public enum State {
12 + /**
13 + * Signifies that the instance is active and operating normally.
14 + */
15 + ACTIVE,
16 +
17 + /**
18 + * Signifies that the instance is inactive, which means either down or
19 + * up, but not operational.
20 + */
21 + INACTIVE
22 + }
23 +
24 + /**
25 + * Returns the instance identifier.
26 + *
27 + * @return instance identifier
28 + */
29 + InstanceId id();
30 +
31 + /**
32 + * Returns the IP address of the controller instance.
33 + *
34 + * @return IP address
35 + */
36 + IpAddress ip();
37 +
38 +}
1 +package org.onlab.onos.cluster;
2 +
3 +/**
4 + * Controller cluster identity.
5 + */
6 +public interface InstanceId {
7 +}
1 +/**
2 + * Set of abstractions for dealing with controller cluster related topics.
3 + */
4 +package org.onlab.onos.cluster;
...\ No newline at end of file ...\ No newline at end of file
...@@ -19,7 +19,7 @@ public class FlowRuleEvent extends AbstractEvent<FlowRuleEvent.Type, FlowRule> { ...@@ -19,7 +19,7 @@ public class FlowRuleEvent extends AbstractEvent<FlowRuleEvent.Type, FlowRule> {
19 /** 19 /**
20 * Signifies that a flow rule has been removed. 20 * Signifies that a flow rule has been removed.
21 */ 21 */
22 - RULE_REMOVED, 22 + RULE_REMOVED
23 } 23 }
24 24
25 /** 25 /**
......
...@@ -23,6 +23,8 @@ public interface FlowRuleService { ...@@ -23,6 +23,8 @@ public interface FlowRuleService {
23 */ 23 */
24 Iterable<FlowEntry> getFlowEntries(DeviceId deviceId); 24 Iterable<FlowEntry> getFlowEntries(DeviceId deviceId);
25 25
26 + // TODO: add createFlowRule factory method and execute operations method
27 +
26 /** 28 /**
27 * Applies the specified flow rules onto their respective devices. These 29 * Applies the specified flow rules onto their respective devices. These
28 * flow rules will be retained by the system and re-applied anytime the 30 * flow rules will be retained by the system and re-applied anytime the
...@@ -46,9 +48,6 @@ public interface FlowRuleService { ...@@ -46,9 +48,6 @@ public interface FlowRuleService {
46 void removeFlowRules(FlowRule... flowRules); 48 void removeFlowRules(FlowRule... flowRules);
47 49
48 50
49 - // void addInitialFlowContributor(InitialFlowContributor contributor);
50 - // void removeInitialFlowContributor(InitialFlowContributor contributor);
51 -
52 /** 51 /**
53 * Adds the specified flow rule listener. 52 * Adds the specified flow rule listener.
54 * 53 *
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
7 description="ONOS 3rd party dependencies"> 7 description="ONOS 3rd party dependencies">
8 <bundle>mvn:commons-lang/commons-lang/2.6</bundle> 8 <bundle>mvn:commons-lang/commons-lang/2.6</bundle>
9 <bundle>mvn:com.google.guava/guava/18.0</bundle> 9 <bundle>mvn:com.google.guava/guava/18.0</bundle>
10 -
11 <bundle>mvn:io.netty/netty/3.9.2.Final</bundle> 10 <bundle>mvn:io.netty/netty/3.9.2.Final</bundle>
12 </feature> 11 </feature>
13 12
...@@ -63,7 +62,7 @@ ...@@ -63,7 +62,7 @@
63 <feature name="onos-openflow" version="1.0.0" 62 <feature name="onos-openflow" version="1.0.0"
64 description="ONOS OpenFlow API, Controller &amp; Providers"> 63 description="ONOS OpenFlow API, Controller &amp; Providers">
65 <feature>onos-api</feature> 64 <feature>onos-api</feature>
66 - 65 + <bundle>mvn:io.netty/netty/3.9.2.Final</bundle>
67 <bundle>mvn:org.onlab.onos/onos-of-api/1.0.0-SNAPSHOT</bundle> 66 <bundle>mvn:org.onlab.onos/onos-of-api/1.0.0-SNAPSHOT</bundle>
68 <bundle>mvn:org.onlab.onos/onos-of-ctl/1.0.0-SNAPSHOT</bundle> 67 <bundle>mvn:org.onlab.onos/onos-of-ctl/1.0.0-SNAPSHOT</bundle>
69 68
...@@ -77,8 +76,9 @@ ...@@ -77,8 +76,9 @@
77 76
78 <feature name="onos-app-tvue" version="1.0.0" 77 <feature name="onos-app-tvue" version="1.0.0"
79 description="ONOS sample topology viewer application"> 78 description="ONOS sample topology viewer application">
80 - <feature>onos-api</feature>
81 <feature>onos-thirdparty-web</feature> 79 <feature>onos-thirdparty-web</feature>
80 + <feature>onos-api</feature>
81 + <feature>onos-core</feature>
82 <bundle>mvn:org.onlab.onos/onos-app-tvue/1.0.0-SNAPSHOT</bundle> 82 <bundle>mvn:org.onlab.onos/onos-app-tvue/1.0.0-SNAPSHOT</bundle>
83 </feature> 83 </feature>
84 84
......
...@@ -15,107 +15,27 @@ ...@@ -15,107 +15,27 @@
15 15
16 <description>ONOS OpenFlow controller subsystem API</description> 16 <description>ONOS OpenFlow controller subsystem API</description>
17 17
18 - <properties>
19 - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20 - <powermock.version>1.5.5</powermock.version>
21 - <restlet.version>2.1.4</restlet.version>
22 - <cobertura-maven-plugin.version>2.6</cobertura-maven-plugin.version>
23 - <!-- Following 2 findbugs version needs to be updated in sync to match the
24 - findbugs version used in findbugs-plugin -->
25 - <findbugs.version>3.0.0</findbugs.version>
26 - <findbugs-plugin.version>3.0.0</findbugs-plugin.version>
27 - <findbugs.effort>Max</findbugs.effort>
28 - <findbugs.excludeFilterFile>${project.basedir}/conf/findbugs/exclude.xml
29 - </findbugs.excludeFilterFile>
30 - <checkstyle-plugin.version>2.12</checkstyle-plugin.version>
31 - <!-- To publish javadoc to github,
32 - uncomment com.github.github site-maven-plugin and
33 - see https://github.com/OPENNETWORKINGLAB/ONOS/pull/425
34 - <github.global.server>github</github.global.server>
35 - -->
36 - <metrics.version>3.0.2</metrics.version>
37 - <maven.surefire.plugin.version>2.16</maven.surefire.plugin.version>
38 - </properties>
39 -
40 <dependencies> 18 <dependencies>
41 <dependency> 19 <dependency>
42 <groupId>org.onlab.onos</groupId> 20 <groupId>org.onlab.onos</groupId>
43 <artifactId>onos-of-api</artifactId> 21 <artifactId>onos-of-api</artifactId>
44 </dependency> 22 </dependency>
45 - <!-- ONOS's direct dependencies -->
46 - <dependency>
47 - <groupId>org.apache.felix</groupId>
48 - <artifactId>org.apache.felix.scr.annotations</artifactId>
49 - <version>1.9.6</version>
50 - </dependency>
51 - <dependency>
52 - <groupId>ch.qos.logback</groupId>
53 - <artifactId>logback-classic</artifactId>
54 - <version>1.1.2</version>
55 - </dependency>
56 - <dependency>
57 - <groupId>ch.qos.logback</groupId>
58 - <artifactId>logback-core</artifactId>
59 - <version>1.1.2</version>
60 - </dependency>
61 - <dependency>
62 - <groupId>org.slf4j</groupId>
63 - <artifactId>slf4j-api</artifactId>
64 - <version>1.7.5</version>
65 - </dependency>
66 - <dependency>
67 - <!-- findbugs suppression annotation and @GuardedBy, etc. -->
68 - <groupId>com.google.code.findbugs</groupId>
69 - <artifactId>annotations</artifactId>
70 - <version>${findbugs.version}</version>
71 - </dependency>
72 <dependency> 23 <dependency>
73 - <groupId>org.projectfloodlight</groupId>
74 - <artifactId>openflowj</artifactId>
75 - <version>0.3.8-SNAPSHOT</version>
76 - </dependency>
77 - <!-- Floodlight's dependencies -->
78 - <dependency>
79 - <!-- dependency to old version of netty? -->
80 <groupId>io.netty</groupId> 24 <groupId>io.netty</groupId>
81 <artifactId>netty</artifactId> 25 <artifactId>netty</artifactId>
82 - <version>3.9.2.Final</version>
83 - </dependency>
84 - <!-- Dependency for libraries used for testing -->
85 - <dependency>
86 - <groupId>junit</groupId>
87 - <artifactId>junit</artifactId>
88 - <version>4.11</version>
89 - <scope>test</scope>
90 - </dependency>
91 - <dependency>
92 - <groupId>org.easymock</groupId>
93 - <artifactId>easymock</artifactId>
94 - <version>3.2</version>
95 - <scope>test</scope>
96 </dependency> 26 </dependency>
97 <dependency> 27 <dependency>
98 - <groupId>org.powermock</groupId> 28 + <groupId>org.apache.felix</groupId>
99 - <artifactId>powermock-module-junit4</artifactId> 29 + <artifactId>org.apache.felix.scr.annotations</artifactId>
100 - <version>${powermock.version}</version>
101 - <scope>test</scope>
102 - </dependency>
103 - <dependency>
104 - <groupId>org.powermock</groupId>
105 - <artifactId>powermock-api-easymock</artifactId>
106 - <version>${powermock.version}</version>
107 - <scope>test</scope>
108 </dependency> 30 </dependency>
109 </dependencies> 31 </dependencies>
110 32
111 -
112 <build> 33 <build>
113 <plugins> 34 <plugins>
114 <plugin> 35 <plugin>
115 <groupId>org.apache.felix</groupId> 36 <groupId>org.apache.felix</groupId>
116 <artifactId>maven-scr-plugin</artifactId> 37 <artifactId>maven-scr-plugin</artifactId>
117 </plugin> 38 </plugin>
118 -
119 </plugins> 39 </plugins>
120 </build> 40 </build>
121 41
......
...@@ -26,8 +26,8 @@ rm -fr $ONOS_STAGE # Remove this when package script is completed ...@@ -26,8 +26,8 @@ rm -fr $ONOS_STAGE # Remove this when package script is completed
26 mkdir -p $ONOS_STAGE 26 mkdir -p $ONOS_STAGE
27 cd $ONOS_STAGE 27 cd $ONOS_STAGE
28 28
29 -# Unroll the Apache Karaf bits and make the ONOS top-level directories. 29 +# Unroll the Apache Karaf bits, prune them and make the ONOS top-level directories.
30 -unzip $KARAF_ZIP 30 +unzip $KARAF_ZIP && rm -rm $KARAF_DIST/demos
31 mkdir bin 31 mkdir bin
32 32
33 # Stage the ONOS admin scripts 33 # Stage the ONOS admin scripts
...@@ -43,11 +43,11 @@ perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onlab.onos/onos-feature ...@@ -43,11 +43,11 @@ perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onlab.onos/onos-feature
43 43
44 # Patch the Apache Karaf distribution file to load ONOS features 44 # Patch the Apache Karaf distribution file to load ONOS features
45 perl -pi.old -e 's|^(featuresBoot=.*)|\1,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-tvue|' \ 45 perl -pi.old -e 's|^(featuresBoot=.*)|\1,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-tvue|' \
46 - /tmp/onos-1.0.0-SNAPSHOT/apache-karaf-3.0.1/etc/org.apache.karaf.features.cfg 46 + $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
47 47
48 # Patch the Apache Karaf distribution with ONOS branding bundle 48 # Patch the Apache Karaf distribution with ONOS branding bundle
49 cp $M2_REPO/org/onlab/onos/onos-branding/$ONOS_VERSION/onos-branding-*.jar \ 49 cp $M2_REPO/org/onlab/onos/onos-branding/$ONOS_VERSION/onos-branding-*.jar \
50 - $ONOS_STAGE/apache-karaf-*/lib 50 + $ONOS_STAGE/$KARAF_DIST/lib
51 51
52 # Now package up the ONOS tar file 52 # Now package up the ONOS tar file
53 cd $ONOS_STAGE_ROOT 53 cd $ONOS_STAGE_ROOT
......