tom

Changed the way ProviderId is made to include URI scheme portion.

Showing 27 changed files with 74 additions and 35 deletions
1 package org.onlab.onos.net.provider; 1 package org.onlab.onos.net.provider;
2 2
3 import com.google.common.collect.ImmutableSet; 3 import com.google.common.collect.ImmutableSet;
4 +import org.onlab.onos.net.DeviceId;
4 5
5 import java.util.HashMap; 6 import java.util.HashMap;
6 import java.util.Map; 7 import java.util.Map;
...@@ -20,6 +21,7 @@ public abstract class AbstractProviderRegistry<P extends Provider, S extends Pro ...@@ -20,6 +21,7 @@ public abstract class AbstractProviderRegistry<P extends Provider, S extends Pro
20 21
21 private final Map<ProviderId, P> providers = new HashMap<>(); 22 private final Map<ProviderId, P> providers = new HashMap<>();
22 private final Map<ProviderId, S> services = new HashMap<>(); 23 private final Map<ProviderId, S> services = new HashMap<>();
24 + private final Map<String, P> providersByScheme = new HashMap<>();
23 25
24 /** 26 /**
25 * Creates a new provider service bound to the specified provider. 27 * Creates a new provider service bound to the specified provider.
...@@ -65,4 +67,14 @@ public abstract class AbstractProviderRegistry<P extends Provider, S extends Pro ...@@ -65,4 +67,14 @@ public abstract class AbstractProviderRegistry<P extends Provider, S extends Pro
65 return providers.get(providerId); 67 return providers.get(providerId);
66 } 68 }
67 69
70 + /**
71 + * Returns the provider for the specified device ID based on URI scheme.
72 + *
73 + * @param deviceId device identifier
74 + * @return provider bound to the URI scheme
75 + */
76 + protected synchronized P getProvider(DeviceId deviceId) {
77 + return providersByScheme.get(deviceId.uri().getScheme());
78 + }
79 +
68 } 80 }
......
...@@ -9,6 +9,7 @@ import static com.google.common.base.MoreObjects.toStringHelper; ...@@ -9,6 +9,7 @@ import static com.google.common.base.MoreObjects.toStringHelper;
9 */ 9 */
10 public class ProviderId { 10 public class ProviderId {
11 11
12 + private final String scheme;
12 private final String id; 13 private final String id;
13 14
14 /** 15 /**
...@@ -16,15 +17,26 @@ public class ProviderId { ...@@ -16,15 +17,26 @@ public class ProviderId {
16 * The providers are expected to follow the reverse DNS convention, e.g. 17 * The providers are expected to follow the reverse DNS convention, e.g.
17 * {@code org.onlab.onos.provider.of.device} 18 * {@code org.onlab.onos.provider.of.device}
18 * 19 *
19 - * @param id string identifier 20 + * @param scheme device URI scheme to which this provider is bound, e.g. "of", "snmp"
21 + * @param id string identifier
20 */ 22 */
21 - public ProviderId(String id) { 23 + public ProviderId(String scheme, String id) {
24 + this.scheme = scheme;
22 this.id = id; 25 this.id = id;
23 } 26 }
24 27
28 + /**
29 + * Returns the device URI scheme to which this provider is bound.
30 + *
31 + * @return device URI scheme
32 + */
33 + public String scheme() {
34 + return scheme;
35 + }
36 +
25 @Override 37 @Override
26 public int hashCode() { 38 public int hashCode() {
27 - return Objects.hash(id); 39 + return Objects.hash(scheme, id);
28 } 40 }
29 41
30 @Override 42 @Override
...@@ -36,12 +48,13 @@ public class ProviderId { ...@@ -36,12 +48,13 @@ public class ProviderId {
36 return false; 48 return false;
37 } 49 }
38 final ProviderId other = (ProviderId) obj; 50 final ProviderId other = (ProviderId) obj;
39 - return Objects.equals(this.id, other.id); 51 + return Objects.equals(this.scheme, other.scheme) &&
52 + Objects.equals(this.id, other.id);
40 } 53 }
41 54
42 @Override 55 @Override
43 public String toString() { 56 public String toString() {
44 - return toStringHelper(this).add("id", id).toString(); 57 + return toStringHelper(this).add("scheme", scheme).add("id", id).toString();
45 } 58 }
46 59
47 } 60 }
......
...@@ -13,7 +13,7 @@ import static org.onlab.onos.net.DeviceId.deviceId; ...@@ -13,7 +13,7 @@ import static org.onlab.onos.net.DeviceId.deviceId;
13 */ 13 */
14 public class DefaultDeviceTest { 14 public class DefaultDeviceTest {
15 15
16 - private static final ProviderId PID = new ProviderId("foo"); 16 + private static final ProviderId PID = new ProviderId("of", "foo");
17 private static final DeviceId DID1 = deviceId("of:foo"); 17 private static final DeviceId DID1 = deviceId("of:foo");
18 private static final DeviceId DID2 = deviceId("of:bar"); 18 private static final DeviceId DID2 = deviceId("of:bar");
19 private static final String MFR = "whitebox"; 19 private static final String MFR = "whitebox";
......
...@@ -15,7 +15,7 @@ import static org.onlab.onos.net.PortNumber.portNumber; ...@@ -15,7 +15,7 @@ import static org.onlab.onos.net.PortNumber.portNumber;
15 */ 15 */
16 public class DefaultEdgeLinkTest { 16 public class DefaultEdgeLinkTest {
17 17
18 - private static final ProviderId PID = new ProviderId("foo"); 18 + private static final ProviderId PID = new ProviderId("of", "foo");
19 private static final DeviceId DID1 = deviceId("of:foo"); 19 private static final DeviceId DID1 = deviceId("of:foo");
20 private static final HostId HID1 = hostId("nic:foobar"); 20 private static final HostId HID1 = hostId("nic:foobar");
21 private static final HostId HID2 = hostId("nic:barfoo"); 21 private static final HostId HID2 = hostId("nic:barfoo");
......
...@@ -15,7 +15,7 @@ import static org.onlab.onos.net.PortNumber.portNumber; ...@@ -15,7 +15,7 @@ import static org.onlab.onos.net.PortNumber.portNumber;
15 */ 15 */
16 public class DefaultLinkTest { 16 public class DefaultLinkTest {
17 17
18 - private static final ProviderId PID = new ProviderId("foo"); 18 + private static final ProviderId PID = new ProviderId("of", "foo");
19 private static final DeviceId DID1 = deviceId("of:foo"); 19 private static final DeviceId DID1 = deviceId("of:foo");
20 private static final DeviceId DID2 = deviceId("of:bar"); 20 private static final DeviceId DID2 = deviceId("of:bar");
21 private static final PortNumber P1 = portNumber(1); 21 private static final PortNumber P1 = portNumber(1);
......
...@@ -14,7 +14,7 @@ import static org.onlab.onos.net.PortNumber.portNumber; ...@@ -14,7 +14,7 @@ import static org.onlab.onos.net.PortNumber.portNumber;
14 */ 14 */
15 public class DefaultPortTest { 15 public class DefaultPortTest {
16 16
17 - private static final ProviderId PID = new ProviderId("foo"); 17 + private static final ProviderId PID = new ProviderId("of", "foo");
18 private static final DeviceId DID1 = deviceId("of:foo"); 18 private static final DeviceId DID1 = deviceId("of:foo");
19 private static final DeviceId DID2 = deviceId("of:bar"); 19 private static final DeviceId DID2 = deviceId("of:bar");
20 private static final PortNumber P1 = portNumber(1); 20 private static final PortNumber P1 = portNumber(1);
......
...@@ -17,7 +17,7 @@ import com.google.common.collect.Sets; ...@@ -17,7 +17,7 @@ import com.google.common.collect.Sets;
17 */ 17 */
18 public abstract class TestDeviceParams { 18 public abstract class TestDeviceParams {
19 19
20 - protected static final ProviderId PID = new ProviderId("foo"); 20 + protected static final ProviderId PID = new ProviderId("of", "foo");
21 protected static final DeviceId DID1 = deviceId("of:foo"); 21 protected static final DeviceId DID1 = deviceId("of:foo");
22 protected static final DeviceId DID2 = deviceId("of:bar"); 22 protected static final DeviceId DID2 = deviceId("of:bar");
23 protected static final MacAddress MAC1 = MacAddress.valueOf("00:11:00:00:00:01"); 23 protected static final MacAddress MAC1 = MacAddress.valueOf("00:11:00:00:00:01");
......
...@@ -18,7 +18,7 @@ import org.onlab.onos.net.provider.ProviderId; ...@@ -18,7 +18,7 @@ import org.onlab.onos.net.provider.ProviderId;
18 public class DeviceEventTest extends AbstractEventTest { 18 public class DeviceEventTest extends AbstractEventTest {
19 19
20 private Device createDevice() { 20 private Device createDevice() {
21 - return new DefaultDevice(new ProviderId("foo"), deviceId("of:foo"), 21 + return new DefaultDevice(new ProviderId("of", "foo"), deviceId("of:foo"),
22 Device.Type.SWITCH, "box", "hw", "sw", "sn"); 22 Device.Type.SWITCH, "box", "hw", "sw", "sn");
23 } 23 }
24 24
......
...@@ -34,7 +34,7 @@ public class HostEventTest extends AbstractEventTest { ...@@ -34,7 +34,7 @@ public class HostEventTest extends AbstractEventTest {
34 HostId hid = HostId.hostId(mac, vlan); 34 HostId hid = HostId.hostId(mac, vlan);
35 35
36 return new DefaultHost( 36 return new DefaultHost(
37 - new ProviderId("foo"), hid, mac, vlan, loc, ipset); 37 + new ProviderId("of", "foo"), hid, mac, vlan, loc, ipset);
38 } 38 }
39 39
40 @Override 40 @Override
......
...@@ -16,7 +16,7 @@ import static org.onlab.onos.net.PortNumber.portNumber; ...@@ -16,7 +16,7 @@ import static org.onlab.onos.net.PortNumber.portNumber;
16 public class LinkEventTest extends AbstractEventTest { 16 public class LinkEventTest extends AbstractEventTest {
17 17
18 private Link createLink() { 18 private Link createLink() {
19 - return new DefaultLink(new ProviderId("foo"), 19 + return new DefaultLink(new ProviderId("of", "foo"),
20 new ConnectPoint(deviceId("of:foo"), portNumber(1)), 20 new ConnectPoint(deviceId("of:foo"), portNumber(1)),
21 new ConnectPoint(deviceId("of:bar"), portNumber(2)), 21 new ConnectPoint(deviceId("of:bar"), portNumber(2)),
22 Link.Type.INDIRECT); 22 Link.Type.INDIRECT);
......
...@@ -28,14 +28,14 @@ public class AbstractProviderRegistryTest { ...@@ -28,14 +28,14 @@ public class AbstractProviderRegistryTest {
28 TestProviderRegistry registry = new TestProviderRegistry(); 28 TestProviderRegistry registry = new TestProviderRegistry();
29 assertEquals("incorrect provider count", 0, registry.getProviders().size()); 29 assertEquals("incorrect provider count", 0, registry.getProviders().size());
30 30
31 - ProviderId fooId = new ProviderId("foo"); 31 + ProviderId fooId = new ProviderId("of", "foo");
32 TestProvider pFoo = new TestProvider(fooId); 32 TestProvider pFoo = new TestProvider(fooId);
33 TestProviderService psFoo = registry.register(pFoo); 33 TestProviderService psFoo = registry.register(pFoo);
34 assertEquals("incorrect provider count", 1, registry.getProviders().size()); 34 assertEquals("incorrect provider count", 1, registry.getProviders().size());
35 assertThat("provider not found", registry.getProviders().contains(fooId)); 35 assertThat("provider not found", registry.getProviders().contains(fooId));
36 assertEquals("incorrect provider", psFoo.provider(), pFoo); 36 assertEquals("incorrect provider", psFoo.provider(), pFoo);
37 37
38 - ProviderId barId = new ProviderId("bar"); 38 + ProviderId barId = new ProviderId("of", "bar");
39 TestProvider pBar = new TestProvider(barId); 39 TestProvider pBar = new TestProvider(barId);
40 TestProviderService psBar = registry.register(pBar); 40 TestProviderService psBar = registry.register(pBar);
41 assertEquals("incorrect provider count", 2, registry.getProviders().size()); 41 assertEquals("incorrect provider count", 2, registry.getProviders().size());
...@@ -52,7 +52,7 @@ public class AbstractProviderRegistryTest { ...@@ -52,7 +52,7 @@ public class AbstractProviderRegistryTest {
52 @Test(expected = IllegalStateException.class) 52 @Test(expected = IllegalStateException.class)
53 public void duplicateRegistration() { 53 public void duplicateRegistration() {
54 TestProviderRegistry registry = new TestProviderRegistry(); 54 TestProviderRegistry registry = new TestProviderRegistry();
55 - TestProvider pFoo = new TestProvider(new ProviderId("foo")); 55 + TestProvider pFoo = new TestProvider(new ProviderId("of", "foo"));
56 registry.register(pFoo); 56 registry.register(pFoo);
57 registry.register(pFoo); 57 registry.register(pFoo);
58 } 58 }
...@@ -60,13 +60,13 @@ public class AbstractProviderRegistryTest { ...@@ -60,13 +60,13 @@ public class AbstractProviderRegistryTest {
60 @Test 60 @Test
61 public void voidUnregistration() { 61 public void voidUnregistration() {
62 TestProviderRegistry registry = new TestProviderRegistry(); 62 TestProviderRegistry registry = new TestProviderRegistry();
63 - registry.unregister(new TestProvider(new ProviderId("foo"))); 63 + registry.unregister(new TestProvider(new ProviderId("of", "foo")));
64 } 64 }
65 65
66 @Test(expected = IllegalStateException.class) 66 @Test(expected = IllegalStateException.class)
67 public void unregistration() { 67 public void unregistration() {
68 TestProviderRegistry registry = new TestProviderRegistry(); 68 TestProviderRegistry registry = new TestProviderRegistry();
69 - TestProvider pFoo = new TestProvider(new ProviderId("foo")); 69 + TestProvider pFoo = new TestProvider(new ProviderId("of", "foo"));
70 TestProviderService psFoo = registry.register(pFoo); 70 TestProviderService psFoo = registry.register(pFoo);
71 registry.unregister(pFoo); 71 registry.unregister(pFoo);
72 psFoo.checkValidity(); 72 psFoo.checkValidity();
......
...@@ -11,7 +11,7 @@ public class AbstractProviderTest { ...@@ -11,7 +11,7 @@ public class AbstractProviderTest {
11 11
12 @Test 12 @Test
13 public void basics() { 13 public void basics() {
14 - ProviderId id = new ProviderId("foo.bar"); 14 + ProviderId id = new ProviderId("of", "foo.bar");
15 TestProvider provider = new TestProvider(id); 15 TestProvider provider = new TestProvider(id);
16 assertEquals("incorrect id", id, provider.id()); 16 assertEquals("incorrect id", id, provider.id());
17 } 17 }
......
...@@ -11,8 +11,9 @@ public class ProviderIdTest { ...@@ -11,8 +11,9 @@ public class ProviderIdTest {
11 @Test 11 @Test
12 public void basics() { 12 public void basics() {
13 new EqualsTester() 13 new EqualsTester()
14 - .addEqualityGroup(new ProviderId("foo"), new ProviderId("foo")) 14 + .addEqualityGroup(new ProviderId("of", "foo"), new ProviderId("of", "foo"))
15 - .addEqualityGroup(new ProviderId("bar")) 15 + .addEqualityGroup(new ProviderId("snmp", "foo"), new ProviderId("snmp", "foo"))
16 + .addEqualityGroup(new ProviderId("of", "bar"))
16 .testEquals(); 17 .testEquals();
17 } 18 }
18 19
......
...@@ -45,7 +45,7 @@ public class DefaultTopology extends AbstractModel implements Topology { ...@@ -45,7 +45,7 @@ public class DefaultTopology extends AbstractModel implements Topology {
45 private static final TarjanGraphSearch<TopologyVertex, TopologyEdge> TARJAN = 45 private static final TarjanGraphSearch<TopologyVertex, TopologyEdge> TARJAN =
46 new TarjanGraphSearch<>(); 46 new TarjanGraphSearch<>();
47 47
48 - private static final ProviderId PID = new ProviderId("org.onlab.onos.net"); 48 + private static final ProviderId PID = new ProviderId("core", "org.onlab.onos.net");
49 49
50 private final long time; 50 private final long time;
51 private final TopologyGraph graph; 51 private final TopologyGraph graph;
......
...@@ -74,7 +74,7 @@ public class DefaultTopologyProvider extends AbstractProvider ...@@ -74,7 +74,7 @@ public class DefaultTopologyProvider extends AbstractProvider
74 * Creates a provider with the supplier identifier. 74 * Creates a provider with the supplier identifier.
75 */ 75 */
76 public DefaultTopologyProvider() { 76 public DefaultTopologyProvider() {
77 - super(new ProviderId("org.onlab.onos.provider.topology")); 77 + super(new ProviderId("core", "org.onlab.onos.provider.topology"));
78 } 78 }
79 79
80 @Activate 80 @Activate
......
...@@ -45,7 +45,7 @@ public class SimplePathManager implements PathService { ...@@ -45,7 +45,7 @@ public class SimplePathManager implements PathService {
45 45
46 private static final String ELEMENT_ID_NULL = "Element ID cannot be null"; 46 private static final String ELEMENT_ID_NULL = "Element ID cannot be null";
47 47
48 - private static final ProviderId PID = new ProviderId("org.onlab.onos.core"); 48 + private static final ProviderId PID = new ProviderId("core", "org.onlab.onos.core");
49 private static final PortNumber P0 = PortNumber.portNumber(0); 49 private static final PortNumber P0 = PortNumber.portNumber(0);
50 50
51 private static final EdgeLink NOT_HOST = new NotHost(); 51 private static final EdgeLink NOT_HOST = new NotHost();
......
...@@ -38,7 +38,7 @@ import static org.onlab.onos.net.device.DeviceEvent.Type.*; ...@@ -38,7 +38,7 @@ import static org.onlab.onos.net.device.DeviceEvent.Type.*;
38 */ 38 */
39 public class SimpleDeviceManagerTest { 39 public class SimpleDeviceManagerTest {
40 40
41 - private static final ProviderId PID = new ProviderId("foo"); 41 + private static final ProviderId PID = new ProviderId("of", "foo");
42 private static final DeviceId DID1 = deviceId("of:foo"); 42 private static final DeviceId DID1 = deviceId("of:foo");
43 private static final DeviceId DID2 = deviceId("of:bar"); 43 private static final DeviceId DID2 = deviceId("of:bar");
44 private static final String MFR = "whitebox"; 44 private static final String MFR = "whitebox";
......
...@@ -42,7 +42,7 @@ import static org.onlab.onos.net.host.HostEvent.Type.*; ...@@ -42,7 +42,7 @@ import static org.onlab.onos.net.host.HostEvent.Type.*;
42 */ 42 */
43 public class SimpleHostManagerTest { 43 public class SimpleHostManagerTest {
44 44
45 - private static final ProviderId PID = new ProviderId("foo"); 45 + private static final ProviderId PID = new ProviderId("of", "foo");
46 46
47 private static final VlanId VLAN1 = VlanId.vlanId((short) 1); 47 private static final VlanId VLAN1 = VlanId.vlanId((short) 1);
48 private static final VlanId VLAN2 = VlanId.vlanId((short) 2); 48 private static final VlanId VLAN2 = VlanId.vlanId((short) 2);
......
...@@ -40,7 +40,7 @@ import static org.onlab.onos.net.link.LinkEvent.Type.*; ...@@ -40,7 +40,7 @@ import static org.onlab.onos.net.link.LinkEvent.Type.*;
40 */ 40 */
41 public class SimpleLinkManagerTest { 41 public class SimpleLinkManagerTest {
42 42
43 - private static final ProviderId PID = new ProviderId("foo"); 43 + private static final ProviderId PID = new ProviderId("of", "foo");
44 private static final DeviceId DID1 = deviceId("of:foo"); 44 private static final DeviceId DID1 = deviceId("of:foo");
45 private static final DeviceId DID2 = deviceId("of:bar"); 45 private static final DeviceId DID2 = deviceId("of:bar");
46 private static final DeviceId DID3 = deviceId("of:goo"); 46 private static final DeviceId DID3 = deviceId("of:goo");
......
...@@ -29,7 +29,7 @@ import static org.onlab.onos.net.trivial.topology.impl.SimpleTopologyManagerTest ...@@ -29,7 +29,7 @@ import static org.onlab.onos.net.trivial.topology.impl.SimpleTopologyManagerTest
29 */ 29 */
30 public class DefaultTopologyTest { 30 public class DefaultTopologyTest {
31 31
32 - public static final ProviderId PID = new ProviderId("foo.bar"); 32 + public static final ProviderId PID = new ProviderId("of", "foo.bar");
33 33
34 public static final DeviceId D1 = deviceId("of:1"); 34 public static final DeviceId D1 = deviceId("of:1");
35 public static final DeviceId D2 = deviceId("of:2"); 35 public static final DeviceId D2 = deviceId("of:2");
......
...@@ -43,7 +43,7 @@ import static org.onlab.onos.net.topology.TopologyEvent.Type.TOPOLOGY_CHANGED; ...@@ -43,7 +43,7 @@ import static org.onlab.onos.net.topology.TopologyEvent.Type.TOPOLOGY_CHANGED;
43 */ 43 */
44 public class SimpleTopologyManagerTest { 44 public class SimpleTopologyManagerTest {
45 45
46 - private static final ProviderId PID = new ProviderId("foo"); 46 + private static final ProviderId PID = new ProviderId("of", "foo");
47 47
48 private SimpleTopologyManager mgr; 48 private SimpleTopologyManager mgr;
49 49
......
...@@ -60,7 +60,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -60,7 +60,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
60 * Creates an OpenFlow device provider. 60 * Creates an OpenFlow device provider.
61 */ 61 */
62 public OpenFlowDeviceProvider() { 62 public OpenFlowDeviceProvider() {
63 - super(new ProviderId("org.onlab.onos.provider.openflow")); 63 + super(new ProviderId("of", "org.onlab.onos.provider.openflow"));
64 } 64 }
65 65
66 @Activate 66 @Activate
......
...@@ -57,7 +57,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr ...@@ -57,7 +57,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr
57 * Creates an OpenFlow host provider. 57 * Creates an OpenFlow host provider.
58 */ 58 */
59 public OpenFlowRuleProvider() { 59 public OpenFlowRuleProvider() {
60 - super(new ProviderId("org.onlab.onos.provider.openflow")); 60 + super(new ProviderId("of", "org.onlab.onos.provider.openflow"));
61 } 61 }
62 62
63 @Activate 63 @Activate
......
...@@ -61,7 +61,7 @@ public class OpenFlowHostProvider extends AbstractProvider implements HostProvid ...@@ -61,7 +61,7 @@ public class OpenFlowHostProvider extends AbstractProvider implements HostProvid
61 * Creates an OpenFlow host provider. 61 * Creates an OpenFlow host provider.
62 */ 62 */
63 public OpenFlowHostProvider() { 63 public OpenFlowHostProvider() {
64 - super(new ProviderId("org.onlab.onos.provider.openflow")); 64 + super(new ProviderId("of", "org.onlab.onos.provider.openflow"));
65 } 65 }
66 66
67 @Activate 67 @Activate
......
...@@ -55,7 +55,7 @@ public class OpenFlowLinkProvider extends AbstractProvider implements LinkProvid ...@@ -55,7 +55,7 @@ public class OpenFlowLinkProvider extends AbstractProvider implements LinkProvid
55 * Creates an OpenFlow link provider. 55 * Creates an OpenFlow link provider.
56 */ 56 */
57 public OpenFlowLinkProvider() { 57 public OpenFlowLinkProvider() {
58 - super(new ProviderId("org.onlab.onos.provider.openflow")); 58 + super(new ProviderId("of", "org.onlab.onos.provider.openflow"));
59 } 59 }
60 60
61 @Activate 61 @Activate
......
...@@ -48,7 +48,7 @@ public class OpenFlowPacketProvider extends AbstractProvider implements PacketPr ...@@ -48,7 +48,7 @@ public class OpenFlowPacketProvider extends AbstractProvider implements PacketPr
48 * Creates an OpenFlow link provider. 48 * Creates an OpenFlow link provider.
49 */ 49 */
50 public OpenFlowPacketProvider() { 50 public OpenFlowPacketProvider() {
51 - super(new ProviderId("org.onlab.onos.provider.openflow")); 51 + super(new ProviderId("of", "org.onlab.onos.provider.openflow"));
52 } 52 }
53 53
54 @Activate 54 @Activate
......
...@@ -32,18 +32,31 @@ cp -r $ONOS_ROOT/tools/package/wrapper/* $KARAF_DIST ...@@ -32,18 +32,31 @@ cp -r $ONOS_ROOT/tools/package/wrapper/* $KARAF_DIST
32 mkdir -p $KARAF_DIST/system/org/onlab 32 mkdir -p $KARAF_DIST/system/org/onlab
33 cp -r $M2_REPO/org/onlab $KARAF_DIST/system/org/ 33 cp -r $M2_REPO/org/onlab $KARAF_DIST/system/org/
34 34
35 +# Wrapper & Cellar Patching ----------------------------------------------------
36 +
37 +# Patch the Apache Karaf distribution file to add Cellar features repository
38 +perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.apache.karaf.cellar/apache-karaf-cellar/3.0.0/xml/features|" \
39 + $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
40 +
41 +# Patch the Apache Karaf distribution file to load ONOS features
42 +perl -pi.old -e 's|^(featuresBoot=.*)|\1,wrapper,cellar|' \
43 + $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
44 +
45 +# ONOS Patching ----------------------------------------------------------------
46 +
35 # Patch the Apache Karaf distribution file to add ONOS features repository 47 # Patch the Apache Karaf distribution file to add ONOS features repository
36 perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onlab.onos/onos-features/$ONOS_VERSION/xml/features|" \ 48 perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onlab.onos/onos-features/$ONOS_VERSION/xml/features|" \
37 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg 49 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
38 50
39 # Patch the Apache Karaf distribution file to load ONOS features 51 # Patch the Apache Karaf distribution file to load ONOS features
40 -perl -pi.old -e 's|^(featuresBoot=.*)|\1,wrapper,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-tvue|' \ 52 +perl -pi.old -e 's|^(featuresBoot=.*)|\1,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-tvue|' \
41 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg 53 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
42 54
43 # Patch the Apache Karaf distribution with ONOS branding bundle 55 # Patch the Apache Karaf distribution with ONOS branding bundle
44 cp $M2_REPO/org/onlab/onos/onos-branding/$ONOS_VERSION/onos-branding-*.jar \ 56 cp $M2_REPO/org/onlab/onos/onos-branding/$ONOS_VERSION/onos-branding-*.jar \
45 $ONOS_STAGE/$KARAF_DIST/lib 57 $ONOS_STAGE/$KARAF_DIST/lib
46 58
59 +
47 # Now package up the ONOS tar file 60 # Now package up the ONOS tar file
48 cd $ONOS_STAGE_ROOT 61 cd $ONOS_STAGE_ROOT
49 COPYFILE_DISABLE=1 tar zcf $ONOS_TAR $ONOS_BITS 62 COPYFILE_DISABLE=1 tar zcf $ONOS_TAR $ONOS_BITS
......