alshabib

cleaning Device Provider

...@@ -43,7 +43,7 @@ import org.slf4j.Logger; ...@@ -43,7 +43,7 @@ import org.slf4j.Logger;
43 @Component(immediate = true) 43 @Component(immediate = true)
44 public class OpenFlowDeviceProvider extends AbstractProvider implements DeviceProvider { 44 public class OpenFlowDeviceProvider extends AbstractProvider implements DeviceProvider {
45 45
46 - private final Logger log = getLogger(getClass()); 46 + private static final Logger LOG = getLogger(OpenFlowDeviceProvider.class);
47 47
48 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 48 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
49 protected DeviceProviderRegistry providerRegistry; 49 protected DeviceProviderRegistry providerRegistry;
...@@ -66,7 +66,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -66,7 +66,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
66 public void activate() { 66 public void activate() {
67 providerService = providerRegistry.register(this); 67 providerService = providerRegistry.register(this);
68 controller.addListener(listener); 68 controller.addListener(listener);
69 - log.info("Started"); 69 + LOG.info("Started");
70 } 70 }
71 71
72 @Deactivate 72 @Deactivate
...@@ -74,33 +74,34 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -74,33 +74,34 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
74 providerRegistry.unregister(this); 74 providerRegistry.unregister(this);
75 controller.removeListener(listener); 75 controller.removeListener(listener);
76 providerService = null; 76 providerService = null;
77 - log.info("Stopped"); 77 + LOG.info("Stopped");
78 } 78 }
79 79
80 @Override 80 @Override
81 public void triggerProbe(Device device) { 81 public void triggerProbe(Device device) {
82 - log.info("Triggering probe on device {}", device.id()); 82 + LOG.info("Triggering probe on device {}", device.id());
83 } 83 }
84 84
85 @Override 85 @Override
86 public void roleChanged(Device device, MastershipRole newRole) { 86 public void roleChanged(Device device, MastershipRole newRole) {
87 switch (newRole) { 87 switch (newRole) {
88 - case MASTER: 88 + case MASTER:
89 - controller.setRole(new Dpid(device.id().uri().getSchemeSpecificPart()), 89 + controller.setRole(new Dpid(device.id().uri().getSchemeSpecificPart()),
90 - RoleState.MASTER); 90 + RoleState.MASTER);
91 - break; 91 + break;
92 - case STANDBY: 92 + case STANDBY:
93 - controller.setRole(new Dpid(device.id().uri().getSchemeSpecificPart()), 93 + controller.setRole(new Dpid(device.id().uri().getSchemeSpecificPart()),
94 - RoleState.EQUAL); 94 + RoleState.EQUAL);
95 - case NONE: 95 + break;
96 - controller.setRole(new Dpid(device.id().uri().getSchemeSpecificPart()), 96 + case NONE:
97 - RoleState.SLAVE); 97 + controller.setRole(new Dpid(device.id().uri().getSchemeSpecificPart()),
98 - break; 98 + RoleState.SLAVE);
99 - default: 99 + break;
100 - log.error("Unknown Mastership state : {}", newRole); 100 + default:
101 + LOG.error("Unknown Mastership state : {}", newRole);
101 102
102 } 103 }
103 - log.info("Accepting mastership role change for device {}", device.id()); 104 + LOG.info("Accepting mastership role change for device {}", device.id());
104 } 105 }
105 106
106 private class InternalDeviceProvider implements OpenFlowSwitchListener { 107 private class InternalDeviceProvider implements OpenFlowSwitchListener {
...@@ -114,10 +115,10 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -114,10 +115,10 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
114 115
115 DeviceDescription description = 116 DeviceDescription description =
116 new DefaultDeviceDescription(buildURI(dpid), Device.Type.SWITCH, 117 new DefaultDeviceDescription(buildURI(dpid), Device.Type.SWITCH,
117 - sw.manfacturerDescription(), 118 + sw.manfacturerDescription(),
118 - sw.hardwareDescription(), 119 + sw.hardwareDescription(),
119 - sw.softwareDescription(), 120 + sw.softwareDescription(),
120 - sw.serialNumber()); 121 + sw.serialNumber());
121 providerService.deviceConnected(deviceId(uri), description); 122 providerService.deviceConnected(deviceId(uri), description);
122 providerService.updatePorts(deviceId(uri), buildPortDescriptions(sw.getPorts())); 123 providerService.updatePorts(deviceId(uri), buildPortDescriptions(sw.getPorts()));
123 } 124 }
...@@ -149,7 +150,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -149,7 +150,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
149 try { 150 try {
150 uri = new URI("of", Long.toHexString(dpid.value()), null); 151 uri = new URI("of", Long.toHexString(dpid.value()), null);
151 } catch (URISyntaxException e) { 152 } catch (URISyntaxException e) {
152 - log.warn("URI construction for device {} failed.", dpid); 153 + LOG.warn("URI construction for device {} failed.", dpid);
153 } 154 }
154 return uri; 155 return uri;
155 } 156 }
......