mirror of
https://github.com/opennetworkinglab/onos.git
synced 2026-05-11 07:06:12 +02:00
[ONOS-6958] Register policon for openflow
Change-Id: Ie54b14f331d0b7affc962a70d93c5da6d7960d13
This commit is contained in:
parent
1ac60f1f96
commit
e1579fa58e
@ -34,6 +34,9 @@ import org.onosproject.net.config.NetworkConfigRegistry;
|
||||
import org.onosproject.net.config.NetworkConfigRegistryAdapter;
|
||||
import org.onosproject.net.driver.AbstractDriverLoader;
|
||||
import org.onosproject.net.optical.OpticalDevice;
|
||||
import org.onosproject.ui.UiGlyph;
|
||||
import org.onosproject.ui.UiGlyphFactory;
|
||||
import org.onosproject.ui.UiExtensionService;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
@ -50,7 +53,34 @@ public class OpticalDriversLoader extends AbstractDriverLoader {
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
|
||||
protected NetworkConfigRegistry registry = new NetworkConfigRegistryAdapter();
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
|
||||
protected UiExtensionService uiExtensionService;
|
||||
|
||||
private UiGlyphFactory glyphFactory =
|
||||
() -> ImmutableList.of(
|
||||
new UiGlyph("policon", "0 0 64 64",
|
||||
"M 32.024746,2 30.163615,19.069136 24.258784,3.015638 "
|
||||
+ "26.879599,19.985033 17.021343,6.007051 23.943688,21.71947 "
|
||||
+ "10.8045,10.769161 21.557349,24.15439 6.031794,16.978659 "
|
||||
+ "19.883076,27.1245 3.027943,24.21114 19.033986,30.42674 "
|
||||
+ "2,31.97526 19.069136,33.83639 3.015638,39.74122 "
|
||||
+ "19.985033,37.12041 6.007051,46.97866 21.719466,40.05632 "
|
||||
+ "10.769161,53.19551 24.154391,42.44265 16.978659,57.96822 "
|
||||
+ "27.124504,44.11693 24.21114,60.97206 30.426738,44.96602 "
|
||||
+ "31.975259,62 33.83639,44.93086 39.74122,60.98437 "
|
||||
+ "37.120405,44.01497 46.978663,57.99296 40.056317,42.28054 "
|
||||
+ "53.195507,53.23084 42.442656,39.84561 57.968215,47.02135 "
|
||||
+ "44.116927,36.8755 60.972063,39.78886 44.966018,33.57327 "
|
||||
+ "62,32.02475 44.930865,30.16362 60.984369,24.25878 "
|
||||
+ "44.014972,26.8796 57.992959,17.021342 42.280539,23.94369 "
|
||||
+ "53.23084,10.8045 39.845614,21.55735 47.021349,6.031794 "
|
||||
+ "36.875501,19.883076 39.788865,3.027943 33.573267,19.033986 Z "
|
||||
+ "m -0.05497,19.23081 A 10.768943,10.768943 0 0 1 "
|
||||
+ "42.769201,31.96977 10.768943,10.768943 0 0 1 "
|
||||
+ "32.030235,42.7692 10.768943,10.768943 0 0 1 "
|
||||
+ "21.230812,32.03023 10.768943,10.768943 0 0 1 "
|
||||
+ "31.969778,21.23081 Z")
|
||||
);
|
||||
|
||||
private final List<ConfigFactory> factories = ImmutableList.of(
|
||||
new ConfigFactory<DeviceId, FlowTableConfig>(DEVICE_SUBJECT_FACTORY,
|
||||
@ -79,6 +109,7 @@ public class OpticalDriversLoader extends AbstractDriverLoader {
|
||||
@Override
|
||||
protected void activate() {
|
||||
factories.forEach(registry::registerConfigFactory);
|
||||
uiExtensionService.register(glyphFactory);
|
||||
|
||||
super.activate();
|
||||
}
|
||||
@ -87,6 +118,7 @@ public class OpticalDriversLoader extends AbstractDriverLoader {
|
||||
@Override
|
||||
protected void deactivate() {
|
||||
factories.forEach(registry::unregisterConfigFactory);
|
||||
uiExtensionService.unregister(glyphFactory);
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
|
||||
@ -104,6 +104,7 @@
|
||||
<behaviour api="org.onosproject.net.behaviour.LambdaQuery"
|
||||
impl="org.onosproject.driver.optical.query.OpenFlowLambdaQuery"/>
|
||||
<property name="meterCapable">false</property>
|
||||
<property name="uiType">policon</property>
|
||||
</driver>
|
||||
|
||||
<driver name="optical-config" manufacturer="config" hwVersion="config" swVersion="config">
|
||||
|
||||
@ -17,6 +17,7 @@ package org.onosproject.drivers.optical;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.onosproject.net.driver.AbstractDriverLoaderTest;
|
||||
import org.onosproject.ui.UiExtensionServiceAdapter;
|
||||
|
||||
/**
|
||||
* Optical drivers loader test.
|
||||
@ -26,5 +27,6 @@ public class OpticalDriversLoaderTest extends AbstractDriverLoaderTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
loader = new OpticalDriversLoader();
|
||||
((OpticalDriversLoader) loader).uiExtensionService = new UiExtensionServiceAdapter();
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,7 +295,10 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler {
|
||||
Device device = event.subject();
|
||||
String uiType = device.annotations().value(AnnotationKeys.UI_TYPE);
|
||||
String devType = uiType != null ? uiType :
|
||||
device.type().toString().toLowerCase();
|
||||
services.driver().getDriver(device.id()).getProperty(AnnotationKeys.UI_TYPE);
|
||||
if (devType == null) {
|
||||
devType = device.type().toString().toLowerCase();
|
||||
}
|
||||
String name = device.annotations().value(AnnotationKeys.NAME);
|
||||
name = isNullOrEmpty(name) ? device.id().toString() : name;
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ import org.onosproject.incubator.net.tunnel.TunnelService;
|
||||
import org.onosproject.mastership.MastershipAdminService;
|
||||
import org.onosproject.mastership.MastershipService;
|
||||
import org.onosproject.net.device.DeviceService;
|
||||
import org.onosproject.net.driver.DriverService;
|
||||
import org.onosproject.net.flow.FlowRuleService;
|
||||
import org.onosproject.net.host.HostService;
|
||||
import org.onosproject.net.intent.IntentService;
|
||||
@ -41,6 +42,7 @@ public class ServicesBundle {
|
||||
|
||||
private TopologyService topologyService;
|
||||
private DeviceService deviceService;
|
||||
private DriverService driverService;
|
||||
private HostService hostService;
|
||||
private LinkService linkService;
|
||||
private TunnelService tunnelService;
|
||||
@ -104,6 +106,15 @@ public class ServicesBundle {
|
||||
return deviceService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the driver service.
|
||||
*
|
||||
* @return driver service reference
|
||||
*/
|
||||
public DriverService driver() {
|
||||
return driverService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the host service.
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user