Committed by
Gerrit Code Review
Addressed some more naming issues throughout the code.
Change-Id: Id679540d55075d902283ad0e2e836b6517752784
Showing
13 changed files
with
80 additions
and
80 deletions
| ... | @@ -109,7 +109,7 @@ public class DhcpManager implements DhcpService { | ... | @@ -109,7 +109,7 @@ public class DhcpManager implements DhcpService { |
| 109 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 109 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 110 | protected PacketService packetService; | 110 | protected PacketService packetService; |
| 111 | 111 | ||
| 112 | - private DHCPPacketProcessor processor = new DHCPPacketProcessor(); | 112 | + private DhcpPacketProcessor processor = new DhcpPacketProcessor(); |
| 113 | 113 | ||
| 114 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 114 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 115 | protected CoreService coreService; | 115 | protected CoreService coreService; |
| ... | @@ -259,7 +259,7 @@ public class DhcpManager implements DhcpService { | ... | @@ -259,7 +259,7 @@ public class DhcpManager implements DhcpService { |
| 259 | return dhcpStore.getAvailableIPs(); | 259 | return dhcpStore.getAvailableIPs(); |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | - private class DHCPPacketProcessor implements PacketProcessor { | 262 | + private class DhcpPacketProcessor implements PacketProcessor { |
| 263 | 263 | ||
| 264 | /** | 264 | /** |
| 265 | * Builds the DHCP Reply packet. | 265 | * Builds the DHCP Reply packet. |
| ... | @@ -437,7 +437,7 @@ public class DhcpManager implements DhcpService { | ... | @@ -437,7 +437,7 @@ public class DhcpManager implements DhcpService { |
| 437 | * @param context context of the incoming message | 437 | * @param context context of the incoming message |
| 438 | * @param dhcpPayload the extracted DHCP payload | 438 | * @param dhcpPayload the extracted DHCP payload |
| 439 | */ | 439 | */ |
| 440 | - private void processDHCPPacket(PacketContext context, DHCP dhcpPayload) { | 440 | + private void processDhcpPacket(PacketContext context, DHCP dhcpPayload) { |
| 441 | Ethernet packet = context.inPacket().parsed(); | 441 | Ethernet packet = context.inPacket().parsed(); |
| 442 | boolean flagIfRequestedIP = false; | 442 | boolean flagIfRequestedIP = false; |
| 443 | boolean flagIfServerIP = false; | 443 | boolean flagIfServerIP = false; |
| ... | @@ -464,9 +464,9 @@ public class DhcpManager implements DhcpService { | ... | @@ -464,9 +464,9 @@ public class DhcpManager implements DhcpService { |
| 464 | } | 464 | } |
| 465 | } | 465 | } |
| 466 | DHCPPacketType outgoingPacketType; | 466 | DHCPPacketType outgoingPacketType; |
| 467 | - MacAddress clientMAC = new MacAddress(dhcpPayload.getClientHardwareAddress()); | 467 | + MacAddress clientMac = new MacAddress(dhcpPayload.getClientHardwareAddress()); |
| 468 | VlanId vlanId = VlanId.vlanId(packet.getVlanID()); | 468 | VlanId vlanId = VlanId.vlanId(packet.getVlanID()); |
| 469 | - HostId hostId = HostId.hostId(clientMAC, vlanId); | 469 | + HostId hostId = HostId.hostId(clientMac, vlanId); |
| 470 | 470 | ||
| 471 | if (incomingPacketType.getValue() == DHCPPacketType.DHCPDISCOVER.getValue()) { | 471 | if (incomingPacketType.getValue() == DHCPPacketType.DHCPDISCOVER.getValue()) { |
| 472 | 472 | ||
| ... | @@ -484,7 +484,7 @@ public class DhcpManager implements DhcpService { | ... | @@ -484,7 +484,7 @@ public class DhcpManager implements DhcpService { |
| 484 | if (flagIfServerIP && flagIfRequestedIP) { | 484 | if (flagIfServerIP && flagIfRequestedIP) { |
| 485 | // SELECTING state | 485 | // SELECTING state |
| 486 | 486 | ||
| 487 | - if (dhcpStore.getIpAssignmentFromAllocationMap(HostId.hostId(clientMAC)) | 487 | + if (dhcpStore.getIpAssignmentFromAllocationMap(HostId.hostId(clientMac)) |
| 488 | .fromOpenStack()) { | 488 | .fromOpenStack()) { |
| 489 | outgoingPacketType = DHCPPacketType.DHCPACK; | 489 | outgoingPacketType = DHCPPacketType.DHCPACK; |
| 490 | Ethernet ethReply = buildReply(packet, requestedIP, (byte) outgoingPacketType.getValue()); | 490 | Ethernet ethReply = buildReply(packet, requestedIP, (byte) outgoingPacketType.getValue()); |
| ... | @@ -544,7 +544,7 @@ public class DhcpManager implements DhcpService { | ... | @@ -544,7 +544,7 @@ public class DhcpManager implements DhcpService { |
| 544 | * @param context context of the incoming message | 544 | * @param context context of the incoming message |
| 545 | * @param packet the ethernet payload | 545 | * @param packet the ethernet payload |
| 546 | */ | 546 | */ |
| 547 | - private void processARPPacket(PacketContext context, Ethernet packet) { | 547 | + private void processArpPacket(PacketContext context, Ethernet packet) { |
| 548 | 548 | ||
| 549 | ARP arpPacket = (ARP) packet.getPayload(); | 549 | ARP arpPacket = (ARP) packet.getPayload(); |
| 550 | 550 | ||
| ... | @@ -605,7 +605,7 @@ public class DhcpManager implements DhcpService { | ... | @@ -605,7 +605,7 @@ public class DhcpManager implements DhcpService { |
| 605 | // This is meant for the dhcp server so process the packet here. | 605 | // This is meant for the dhcp server so process the packet here. |
| 606 | 606 | ||
| 607 | DHCP dhcpPayload = (DHCP) udpPacket.getPayload(); | 607 | DHCP dhcpPayload = (DHCP) udpPacket.getPayload(); |
| 608 | - processDHCPPacket(context, dhcpPayload); | 608 | + processDhcpPacket(context, dhcpPayload); |
| 609 | } | 609 | } |
| 610 | } | 610 | } |
| 611 | } else if (packet.getEtherType() == Ethernet.TYPE_ARP) { | 611 | } else if (packet.getEtherType() == Ethernet.TYPE_ARP) { |
| ... | @@ -614,7 +614,7 @@ public class DhcpManager implements DhcpService { | ... | @@ -614,7 +614,7 @@ public class DhcpManager implements DhcpService { |
| 614 | if ((arpPacket.getOpCode() == ARP.OP_REQUEST) && | 614 | if ((arpPacket.getOpCode() == ARP.OP_REQUEST) && |
| 615 | Objects.equals(myIP, Ip4Address.valueOf(arpPacket.getTargetProtocolAddress()))) { | 615 | Objects.equals(myIP, Ip4Address.valueOf(arpPacket.getTargetProtocolAddress()))) { |
| 616 | 616 | ||
| 617 | - processARPPacket(context, packet); | 617 | + processArpPacket(context, packet); |
| 618 | 618 | ||
| 619 | } | 619 | } |
| 620 | } | 620 | } |
| ... | @@ -727,4 +727,4 @@ public class DhcpManager implements DhcpService { | ... | @@ -727,4 +727,4 @@ public class DhcpManager implements DhcpService { |
| 727 | timeout = Timer.getTimer().newTimeout(new PurgeListTask(), timerDelay, TimeUnit.MINUTES); | 727 | timeout = Timer.getTimer().newTimeout(new PurgeListTask(), timerDelay, TimeUnit.MINUTES); |
| 728 | } | 728 | } |
| 729 | } | 729 | } |
| 730 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 730 | +} | ... | ... |
| ... | @@ -42,7 +42,7 @@ import java.util.Map; | ... | @@ -42,7 +42,7 @@ import java.util.Map; |
| 42 | * Manage DHCP address assignments. | 42 | * Manage DHCP address assignments. |
| 43 | */ | 43 | */ |
| 44 | @Path("dhcp") | 44 | @Path("dhcp") |
| 45 | -public class DHCPWebResource extends AbstractWebResource { | 45 | +public class DhcpWebResource extends AbstractWebResource { |
| 46 | 46 | ||
| 47 | final DhcpService service = get(DhcpService.class); | 47 | final DhcpService service = get(DhcpService.class); |
| 48 | 48 | ... | ... |
| ... | @@ -30,7 +30,7 @@ | ... | @@ -30,7 +30,7 @@ |
| 30 | <init-param> | 30 | <init-param> |
| 31 | <param-name>com.sun.jersey.config.property.classnames</param-name> | 31 | <param-name>com.sun.jersey.config.property.classnames</param-name> |
| 32 | <param-value> | 32 | <param-value> |
| 33 | - org.onosproject.dhcp.rest.DHCPWebResource | 33 | + org.onosproject.dhcp.rest.DhcpWebResource |
| 34 | </param-value> | 34 | </param-value> |
| 35 | </init-param> | 35 | </init-param> |
| 36 | <load-on-startup>1</load-on-startup> | 36 | <load-on-startup>1</load-on-startup> | ... | ... |
| ... | @@ -106,7 +106,7 @@ public class DhcpManagerTest { | ... | @@ -106,7 +106,7 @@ public class DhcpManagerTest { |
| 106 | */ | 106 | */ |
| 107 | @Test | 107 | @Test |
| 108 | public void testDiscover() { | 108 | public void testDiscover() { |
| 109 | - Ethernet reply = constructDHCPPacket(DHCPPacketType.DHCPDISCOVER); | 109 | + Ethernet reply = constructDhcpPacket(DHCPPacketType.DHCPDISCOVER); |
| 110 | sendPacket(reply); | 110 | sendPacket(reply); |
| 111 | } | 111 | } |
| 112 | 112 | ||
| ... | @@ -115,7 +115,7 @@ public class DhcpManagerTest { | ... | @@ -115,7 +115,7 @@ public class DhcpManagerTest { |
| 115 | */ | 115 | */ |
| 116 | @Test | 116 | @Test |
| 117 | public void testRequest() { | 117 | public void testRequest() { |
| 118 | - Ethernet reply = constructDHCPPacket(DHCPPacketType.DHCPREQUEST); | 118 | + Ethernet reply = constructDhcpPacket(DHCPPacketType.DHCPREQUEST); |
| 119 | sendPacket(reply); | 119 | sendPacket(reply); |
| 120 | } | 120 | } |
| 121 | 121 | ||
| ... | @@ -138,7 +138,7 @@ public class DhcpManagerTest { | ... | @@ -138,7 +138,7 @@ public class DhcpManagerTest { |
| 138 | * @param packetType DHCP Message Type | 138 | * @param packetType DHCP Message Type |
| 139 | * @return Ethernet packet | 139 | * @return Ethernet packet |
| 140 | */ | 140 | */ |
| 141 | - private Ethernet constructDHCPPacket(DHCPPacketType packetType) { | 141 | + private Ethernet constructDhcpPacket(DHCPPacketType packetType) { |
| 142 | 142 | ||
| 143 | // Ethernet Frame. | 143 | // Ethernet Frame. |
| 144 | Ethernet ethReply = new Ethernet(); | 144 | Ethernet ethReply = new Ethernet(); | ... | ... |
| ... | @@ -120,7 +120,7 @@ public class OpenstackSwitchingRulePopulator { | ... | @@ -120,7 +120,7 @@ public class OpenstackSwitchingRulePopulator { |
| 120 | * | 120 | * |
| 121 | * @param id device ID to set the rules | 121 | * @param id device ID to set the rules |
| 122 | */ | 122 | */ |
| 123 | - private void setFlowRuleForDHCP(DeviceId id) { | 123 | + private void setFlowRuleForDhcp(DeviceId id) { |
| 124 | TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder(); | 124 | TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder(); |
| 125 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); | 125 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); |
| 126 | 126 | ... | ... |
| ... | @@ -462,10 +462,10 @@ public class PicaPipeline extends AbstractHandlerBehaviour implements Pipeliner | ... | @@ -462,10 +462,10 @@ public class PicaPipeline extends AbstractHandlerBehaviour implements Pipeliner |
| 462 | 462 | ||
| 463 | private void initializePipeline() { | 463 | private void initializePipeline() { |
| 464 | //processIpUnicastTable(true); | 464 | //processIpUnicastTable(true); |
| 465 | - processACLTable(true); | 465 | + processAclTable(true); |
| 466 | } | 466 | } |
| 467 | 467 | ||
| 468 | - private void processACLTable(boolean install) { | 468 | + private void processAclTable(boolean install) { |
| 469 | TrafficSelector.Builder selector; | 469 | TrafficSelector.Builder selector; |
| 470 | TrafficTreatment.Builder treatment; | 470 | TrafficTreatment.Builder treatment; |
| 471 | FlowRuleOperations.Builder ops = FlowRuleOperations.builder(); | 471 | FlowRuleOperations.Builder ops = FlowRuleOperations.builder(); | ... | ... |
| ... | @@ -94,12 +94,12 @@ public class Controller { | ... | @@ -94,12 +94,12 @@ public class Controller { |
| 94 | protected String tsLocation; | 94 | protected String tsLocation; |
| 95 | protected char[] ksPwd; | 95 | protected char[] ksPwd; |
| 96 | protected char[] tsPwd; | 96 | protected char[] tsPwd; |
| 97 | - protected SSLEngine serverSSLEngine; | 97 | + protected SSLEngine serverSslEngine; |
| 98 | 98 | ||
| 99 | // Perf. related configuration | 99 | // Perf. related configuration |
| 100 | protected static final int SEND_BUFFER_SIZE = 4 * 1024 * 1024; | 100 | protected static final int SEND_BUFFER_SIZE = 4 * 1024 * 1024; |
| 101 | private DriverService driverService; | 101 | private DriverService driverService; |
| 102 | - private boolean enableOFTLS = TLS_DISABLED; | 102 | + private boolean enableOfTls = TLS_DISABLED; |
| 103 | 103 | ||
| 104 | // *************** | 104 | // *************** |
| 105 | // Getters/Setters | 105 | // Getters/Setters |
| ... | @@ -132,7 +132,7 @@ public class Controller { | ... | @@ -132,7 +132,7 @@ public class Controller { |
| 132 | bootstrap.setOption("child.sendBufferSize", Controller.SEND_BUFFER_SIZE); | 132 | bootstrap.setOption("child.sendBufferSize", Controller.SEND_BUFFER_SIZE); |
| 133 | 133 | ||
| 134 | ChannelPipelineFactory pfact = | 134 | ChannelPipelineFactory pfact = |
| 135 | - new OpenflowPipelineFactory(this, null, serverSSLEngine); | 135 | + new OpenflowPipelineFactory(this, null, serverSslEngine); |
| 136 | bootstrap.setPipelineFactory(pfact); | 136 | bootstrap.setPipelineFactory(pfact); |
| 137 | cg = new DefaultChannelGroup(); | 137 | cg = new DefaultChannelGroup(); |
| 138 | openFlowPorts.forEach(port -> { | 138 | openFlowPorts.forEach(port -> { |
| ... | @@ -189,9 +189,9 @@ public class Controller { | ... | @@ -189,9 +189,9 @@ public class Controller { |
| 189 | this.systemStartTime = System.currentTimeMillis(); | 189 | this.systemStartTime = System.currentTimeMillis(); |
| 190 | 190 | ||
| 191 | try { | 191 | try { |
| 192 | - getTLSParameters(); | 192 | + getTlsParameters(); |
| 193 | - if (enableOFTLS) { | 193 | + if (enableOfTls) { |
| 194 | - initSSL(); | 194 | + initSsl(); |
| 195 | } | 195 | } |
| 196 | } catch (Exception ex) { | 196 | } catch (Exception ex) { |
| 197 | log.error("SSL init failed: {}", ex.getMessage()); | 197 | log.error("SSL init failed: {}", ex.getMessage()); |
| ... | @@ -199,35 +199,35 @@ public class Controller { | ... | @@ -199,35 +199,35 @@ public class Controller { |
| 199 | 199 | ||
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | - private void getTLSParameters() { | 202 | + private void getTlsParameters() { |
| 203 | String tempString = System.getProperty("enableOFTLS"); | 203 | String tempString = System.getProperty("enableOFTLS"); |
| 204 | - enableOFTLS = Strings.isNullOrEmpty(tempString) ? TLS_DISABLED : Boolean.parseBoolean(tempString); | 204 | + enableOfTls = Strings.isNullOrEmpty(tempString) ? TLS_DISABLED : Boolean.parseBoolean(tempString); |
| 205 | - log.info("OpenFlow Security is {}", enableOFTLS ? "enabled" : "disabled"); | 205 | + log.info("OpenFlow Security is {}", enableOfTls ? "enabled" : "disabled"); |
| 206 | - if (enableOFTLS) { | 206 | + if (enableOfTls) { |
| 207 | ksLocation = System.getProperty("javax.net.ssl.keyStore"); | 207 | ksLocation = System.getProperty("javax.net.ssl.keyStore"); |
| 208 | if (Strings.isNullOrEmpty(ksLocation)) { | 208 | if (Strings.isNullOrEmpty(ksLocation)) { |
| 209 | - enableOFTLS = TLS_DISABLED; | 209 | + enableOfTls = TLS_DISABLED; |
| 210 | return; | 210 | return; |
| 211 | } | 211 | } |
| 212 | tsLocation = System.getProperty("javax.net.ssl.trustStore"); | 212 | tsLocation = System.getProperty("javax.net.ssl.trustStore"); |
| 213 | if (Strings.isNullOrEmpty(tsLocation)) { | 213 | if (Strings.isNullOrEmpty(tsLocation)) { |
| 214 | - enableOFTLS = TLS_DISABLED; | 214 | + enableOfTls = TLS_DISABLED; |
| 215 | return; | 215 | return; |
| 216 | } | 216 | } |
| 217 | ksPwd = System.getProperty("javax.net.ssl.keyStorePassword").toCharArray(); | 217 | ksPwd = System.getProperty("javax.net.ssl.keyStorePassword").toCharArray(); |
| 218 | if (MIN_KS_LENGTH > ksPwd.length) { | 218 | if (MIN_KS_LENGTH > ksPwd.length) { |
| 219 | - enableOFTLS = TLS_DISABLED; | 219 | + enableOfTls = TLS_DISABLED; |
| 220 | return; | 220 | return; |
| 221 | } | 221 | } |
| 222 | tsPwd = System.getProperty("javax.net.ssl.trustStorePassword").toCharArray(); | 222 | tsPwd = System.getProperty("javax.net.ssl.trustStorePassword").toCharArray(); |
| 223 | if (MIN_KS_LENGTH > tsPwd.length) { | 223 | if (MIN_KS_LENGTH > tsPwd.length) { |
| 224 | - enableOFTLS = TLS_DISABLED; | 224 | + enableOfTls = TLS_DISABLED; |
| 225 | return; | 225 | return; |
| 226 | } | 226 | } |
| 227 | } | 227 | } |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | - private void initSSL() throws Exception { | 230 | + private void initSsl() throws Exception { |
| 231 | 231 | ||
| 232 | TrustManagerFactory tmFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); | 232 | TrustManagerFactory tmFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); |
| 233 | KeyStore ts = KeyStore.getInstance("JKS"); | 233 | KeyStore ts = KeyStore.getInstance("JKS"); |
| ... | @@ -242,13 +242,13 @@ public class Controller { | ... | @@ -242,13 +242,13 @@ public class Controller { |
| 242 | SSLContext serverContext = SSLContext.getInstance("TLS"); | 242 | SSLContext serverContext = SSLContext.getInstance("TLS"); |
| 243 | serverContext.init(kmf.getKeyManagers(), tmFactory.getTrustManagers(), null); | 243 | serverContext.init(kmf.getKeyManagers(), tmFactory.getTrustManagers(), null); |
| 244 | 244 | ||
| 245 | - serverSSLEngine = serverContext.createSSLEngine(); | 245 | + serverSslEngine = serverContext.createSSLEngine(); |
| 246 | 246 | ||
| 247 | - serverSSLEngine.setNeedClientAuth(true); | 247 | + serverSslEngine.setNeedClientAuth(true); |
| 248 | - serverSSLEngine.setUseClientMode(false); | 248 | + serverSslEngine.setUseClientMode(false); |
| 249 | - serverSSLEngine.setEnabledProtocols(serverSSLEngine.getSupportedProtocols()); | 249 | + serverSslEngine.setEnabledProtocols(serverSslEngine.getSupportedProtocols()); |
| 250 | - serverSSLEngine.setEnabledCipherSuites(serverSSLEngine.getSupportedCipherSuites()); | 250 | + serverSslEngine.setEnabledCipherSuites(serverSslEngine.getSupportedCipherSuites()); |
| 251 | - serverSSLEngine.setEnableSessionCreation(true); | 251 | + serverSslEngine.setEnableSessionCreation(true); |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | // ************** | 254 | // ************** | ... | ... |
| ... | @@ -191,7 +191,7 @@ public class ControllerTest { | ... | @@ -191,7 +191,7 @@ public class ControllerTest { |
| 191 | controller.setConfigParams(properties); | 191 | controller.setConfigParams(properties); |
| 192 | controller.start(null, new MockDriverService()); | 192 | controller.start(null, new MockDriverService()); |
| 193 | 193 | ||
| 194 | - assertThat(controller.serverSSLEngine, notNullValue()); | 194 | + assertThat(controller.serverSslEngine, notNullValue()); |
| 195 | 195 | ||
| 196 | controller.stop(); | 196 | controller.stop(); |
| 197 | boolean removed = keystore.delete(); | 197 | boolean removed = keystore.delete(); | ... | ... |
| ... | @@ -196,16 +196,16 @@ public class HostLocationProviderTest { | ... | @@ -196,16 +196,16 @@ public class HostLocationProviderTest { |
| 196 | providerService.clear(); | 196 | providerService.clear(); |
| 197 | 197 | ||
| 198 | // new host | 198 | // new host |
| 199 | - testProcessor.process(new TestNAPacketContext(DEV4)); | 199 | + testProcessor.process(new TestNaPacketContext(DEV4)); |
| 200 | assertNotNull("new host expected", providerService.added); | 200 | assertNotNull("new host expected", providerService.added); |
| 201 | assertNull("host motion unexpected", providerService.moved); | 201 | assertNull("host motion unexpected", providerService.moved); |
| 202 | 202 | ||
| 203 | // the host moved to new switch | 203 | // the host moved to new switch |
| 204 | - testProcessor.process(new TestNAPacketContext(DEV5)); | 204 | + testProcessor.process(new TestNaPacketContext(DEV5)); |
| 205 | assertNotNull("host motion expected", providerService.moved); | 205 | assertNotNull("host motion expected", providerService.moved); |
| 206 | 206 | ||
| 207 | // the host was misheard on a spine | 207 | // the host was misheard on a spine |
| 208 | - testProcessor.process(new TestNAPacketContext(DEV6)); | 208 | + testProcessor.process(new TestNaPacketContext(DEV6)); |
| 209 | assertNull("host misheard on spine switch", providerService.spine); | 209 | assertNull("host misheard on spine switch", providerService.spine); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| ... | @@ -213,7 +213,7 @@ public class HostLocationProviderTest { | ... | @@ -213,7 +213,7 @@ public class HostLocationProviderTest { |
| 213 | public void removeHostByDeviceRemove() { | 213 | public void removeHostByDeviceRemove() { |
| 214 | provider.modified(CTX_FOR_REMOVE); | 214 | provider.modified(CTX_FOR_REMOVE); |
| 215 | testProcessor.process(new TestArpPacketContext(DEV1)); | 215 | testProcessor.process(new TestArpPacketContext(DEV1)); |
| 216 | - testProcessor.process(new TestNAPacketContext(DEV4)); | 216 | + testProcessor.process(new TestNaPacketContext(DEV4)); |
| 217 | 217 | ||
| 218 | Device device = new DefaultDevice(ProviderId.NONE, deviceId(DEV1), SWITCH, | 218 | Device device = new DefaultDevice(ProviderId.NONE, deviceId(DEV1), SWITCH, |
| 219 | "m", "h", "s", "n", new ChassisId(0L)); | 219 | "m", "h", "s", "n", new ChassisId(0L)); |
| ... | @@ -292,8 +292,8 @@ public class HostLocationProviderTest { | ... | @@ -292,8 +292,8 @@ public class HostLocationProviderTest { |
| 292 | * When receiving NeighborAdvertisement, updates location and IP. | 292 | * When receiving NeighborAdvertisement, updates location and IP. |
| 293 | */ | 293 | */ |
| 294 | @Test | 294 | @Test |
| 295 | - public void testReceiveNA() { | 295 | + public void testReceiveNa() { |
| 296 | - testProcessor.process(new TestNAPacketContext(DEV4)); | 296 | + testProcessor.process(new TestNaPacketContext(DEV4)); |
| 297 | assertNotNull(providerService.added); | 297 | assertNotNull(providerService.added); |
| 298 | HostDescription descr = providerService.added; | 298 | HostDescription descr = providerService.added; |
| 299 | assertThat(descr.location(), is(LOCATION2)); | 299 | assertThat(descr.location(), is(LOCATION2)); |
| ... | @@ -306,8 +306,8 @@ public class HostLocationProviderTest { | ... | @@ -306,8 +306,8 @@ public class HostLocationProviderTest { |
| 306 | * When receiving NeighborSolicitation, updates location and IP. | 306 | * When receiving NeighborSolicitation, updates location and IP. |
| 307 | */ | 307 | */ |
| 308 | @Test | 308 | @Test |
| 309 | - public void testReceiveNS() { | 309 | + public void testReceiveNs() { |
| 310 | - testProcessor.process(new TestNSPacketContext(DEV4)); | 310 | + testProcessor.process(new TestNsPacketContext(DEV4)); |
| 311 | HostDescription descr = providerService.added; | 311 | HostDescription descr = providerService.added; |
| 312 | assertThat(descr.location(), is(LOCATION2)); | 312 | assertThat(descr.location(), is(LOCATION2)); |
| 313 | assertThat(descr.hwAddress(), is(MAC2)); | 313 | assertThat(descr.hwAddress(), is(MAC2)); |
| ... | @@ -319,7 +319,7 @@ public class HostLocationProviderTest { | ... | @@ -319,7 +319,7 @@ public class HostLocationProviderTest { |
| 319 | * When receiving RouterAdvertisement, ignores it. | 319 | * When receiving RouterAdvertisement, ignores it. |
| 320 | */ | 320 | */ |
| 321 | @Test | 321 | @Test |
| 322 | - public void testReceivesRA() { | 322 | + public void testReceivesRa() { |
| 323 | testProcessor.process(new TestRAPacketContext(DEV4)); | 323 | testProcessor.process(new TestRAPacketContext(DEV4)); |
| 324 | assertNull(providerService.added); | 324 | assertNull(providerService.added); |
| 325 | } | 325 | } |
| ... | @@ -328,7 +328,7 @@ public class HostLocationProviderTest { | ... | @@ -328,7 +328,7 @@ public class HostLocationProviderTest { |
| 328 | * When receiving RouterSolicitation, ignores it. | 328 | * When receiving RouterSolicitation, ignores it. |
| 329 | */ | 329 | */ |
| 330 | @Test | 330 | @Test |
| 331 | - public void testReceiveRS() { | 331 | + public void testReceiveRs() { |
| 332 | testProcessor.process(new TestRSPacketContext(DEV4)); | 332 | testProcessor.process(new TestRSPacketContext(DEV4)); |
| 333 | assertNull(providerService.added); | 333 | assertNull(providerService.added); |
| 334 | } | 334 | } |
| ... | @@ -337,8 +337,8 @@ public class HostLocationProviderTest { | ... | @@ -337,8 +337,8 @@ public class HostLocationProviderTest { |
| 337 | * When receiving Duplicate Address Detection (DAD), ignores it. | 337 | * When receiving Duplicate Address Detection (DAD), ignores it. |
| 338 | */ | 338 | */ |
| 339 | @Test | 339 | @Test |
| 340 | - public void testReceiveDAD() { | 340 | + public void testReceiveDad() { |
| 341 | - testProcessor.process(new TestDADPacketContext(DEV4)); | 341 | + testProcessor.process(new TestDadPacketContext(DEV4)); |
| 342 | assertNull(providerService.added); | 342 | assertNull(providerService.added); |
| 343 | } | 343 | } |
| 344 | 344 | ||
| ... | @@ -575,10 +575,10 @@ public class HostLocationProviderTest { | ... | @@ -575,10 +575,10 @@ public class HostLocationProviderTest { |
| 575 | /** | 575 | /** |
| 576 | * Generates NeighborAdvertisement packet. | 576 | * Generates NeighborAdvertisement packet. |
| 577 | */ | 577 | */ |
| 578 | - private class TestNAPacketContext implements PacketContext { | 578 | + private class TestNaPacketContext implements PacketContext { |
| 579 | private final String deviceId; | 579 | private final String deviceId; |
| 580 | 580 | ||
| 581 | - public TestNAPacketContext(String deviceId) { | 581 | + public TestNaPacketContext(String deviceId) { |
| 582 | this.deviceId = deviceId; | 582 | this.deviceId = deviceId; |
| 583 | } | 583 | } |
| 584 | 584 | ||
| ... | @@ -637,10 +637,10 @@ public class HostLocationProviderTest { | ... | @@ -637,10 +637,10 @@ public class HostLocationProviderTest { |
| 637 | /** | 637 | /** |
| 638 | * Generates NeighborSolicitation packet. | 638 | * Generates NeighborSolicitation packet. |
| 639 | */ | 639 | */ |
| 640 | - private class TestNSPacketContext implements PacketContext { | 640 | + private class TestNsPacketContext implements PacketContext { |
| 641 | private final String deviceId; | 641 | private final String deviceId; |
| 642 | 642 | ||
| 643 | - public TestNSPacketContext(String deviceId) { | 643 | + public TestNsPacketContext(String deviceId) { |
| 644 | this.deviceId = deviceId; | 644 | this.deviceId = deviceId; |
| 645 | } | 645 | } |
| 646 | 646 | ||
| ... | @@ -699,10 +699,10 @@ public class HostLocationProviderTest { | ... | @@ -699,10 +699,10 @@ public class HostLocationProviderTest { |
| 699 | /** | 699 | /** |
| 700 | * Generates Duplicate Address Detection packet. | 700 | * Generates Duplicate Address Detection packet. |
| 701 | */ | 701 | */ |
| 702 | - private class TestDADPacketContext implements PacketContext { | 702 | + private class TestDadPacketContext implements PacketContext { |
| 703 | private final String deviceId; | 703 | private final String deviceId; |
| 704 | 704 | ||
| 705 | - public TestDADPacketContext(String deviceId) { | 705 | + public TestDadPacketContext(String deviceId) { |
| 706 | this.deviceId = deviceId; | 706 | this.deviceId = deviceId; |
| 707 | } | 707 | } |
| 708 | 708 | ... | ... |
| ... | @@ -58,7 +58,7 @@ interface DiscoveryContext { | ... | @@ -58,7 +58,7 @@ interface DiscoveryContext { |
| 58 | * | 58 | * |
| 59 | * @return true to emit BDDP | 59 | * @return true to emit BDDP |
| 60 | */ | 60 | */ |
| 61 | - boolean useBDDP(); | 61 | + boolean useBddp(); |
| 62 | 62 | ||
| 63 | /** | 63 | /** |
| 64 | * Touches the link identified by the given key to indicate that it's active. | 64 | * Touches the link identified by the given key to indicate that it's active. | ... | ... |
| ... | @@ -155,7 +155,7 @@ class LinkDiscovery implements TimerTask { | ... | @@ -155,7 +155,7 @@ class LinkDiscovery implements TimerTask { |
| 155 | * @param packetContext packet context | 155 | * @param packetContext packet context |
| 156 | * @return true if handled | 156 | * @return true if handled |
| 157 | */ | 157 | */ |
| 158 | - boolean handleLLDP(PacketContext packetContext) { | 158 | + boolean handleLldp(PacketContext packetContext) { |
| 159 | Ethernet eth = packetContext.inPacket().parsed(); | 159 | Ethernet eth = packetContext.inPacket().parsed(); |
| 160 | if (eth == null) { | 160 | if (eth == null) { |
| 161 | return false; | 161 | return false; |
| ... | @@ -216,7 +216,7 @@ class LinkDiscovery implements TimerTask { | ... | @@ -216,7 +216,7 @@ class LinkDiscovery implements TimerTask { |
| 216 | * @param port the port | 216 | * @param port the port |
| 217 | * @return Packet_out message with LLDP data | 217 | * @return Packet_out message with LLDP data |
| 218 | */ | 218 | */ |
| 219 | - private OutboundPacket createOutBoundLLDP(Long port) { | 219 | + private OutboundPacket createOutBoundLldp(Long port) { |
| 220 | if (port == null) { | 220 | if (port == null) { |
| 221 | return null; | 221 | return null; |
| 222 | } | 222 | } |
| ... | @@ -233,7 +233,7 @@ class LinkDiscovery implements TimerTask { | ... | @@ -233,7 +233,7 @@ class LinkDiscovery implements TimerTask { |
| 233 | * @param port the port | 233 | * @param port the port |
| 234 | * @return Packet_out message with LLDP data | 234 | * @return Packet_out message with LLDP data |
| 235 | */ | 235 | */ |
| 236 | - private OutboundPacket createOutBoundBDDP(Long port) { | 236 | + private OutboundPacket createOutBoundBddp(Long port) { |
| 237 | if (port == null) { | 237 | if (port == null) { |
| 238 | return null; | 238 | return null; |
| 239 | } | 239 | } |
| ... | @@ -246,10 +246,10 @@ class LinkDiscovery implements TimerTask { | ... | @@ -246,10 +246,10 @@ class LinkDiscovery implements TimerTask { |
| 246 | 246 | ||
| 247 | private void sendProbes(Long portNumber) { | 247 | private void sendProbes(Long portNumber) { |
| 248 | log.trace("Sending probes out to {}@{}", portNumber, device.id()); | 248 | log.trace("Sending probes out to {}@{}", portNumber, device.id()); |
| 249 | - OutboundPacket pkt = createOutBoundLLDP(portNumber); | 249 | + OutboundPacket pkt = createOutBoundLldp(portNumber); |
| 250 | context.packetService().emit(pkt); | 250 | context.packetService().emit(pkt); |
| 251 | - if (context.useBDDP()) { | 251 | + if (context.useBddp()) { |
| 252 | - OutboundPacket bpkt = createOutBoundBDDP(portNumber); | 252 | + OutboundPacket bpkt = createOutBoundBddp(portNumber); |
| 253 | context.packetService().emit(bpkt); | 253 | context.packetService().emit(bpkt); |
| 254 | } | 254 | } |
| 255 | } | 255 | } | ... | ... |
| ... | @@ -81,7 +81,7 @@ import static org.slf4j.LoggerFactory.getLogger; | ... | @@ -81,7 +81,7 @@ import static org.slf4j.LoggerFactory.getLogger; |
| 81 | * Provider which uses LLDP and BDDP packets to detect network infrastructure links. | 81 | * Provider which uses LLDP and BDDP packets to detect network infrastructure links. |
| 82 | */ | 82 | */ |
| 83 | @Component(immediate = true) | 83 | @Component(immediate = true) |
| 84 | -public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { | 84 | +public class LldpLinkProvider extends AbstractProvider implements LinkProvider { |
| 85 | 85 | ||
| 86 | private static final String PROVIDER_NAME = "org.onosproject.provider.lldp"; | 86 | private static final String PROVIDER_NAME = "org.onosproject.provider.lldp"; |
| 87 | 87 | ||
| ... | @@ -138,7 +138,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { | ... | @@ -138,7 +138,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { |
| 138 | private static final String PROP_USE_BDDP = "useBDDP"; | 138 | private static final String PROP_USE_BDDP = "useBDDP"; |
| 139 | @Property(name = PROP_USE_BDDP, boolValue = true, | 139 | @Property(name = PROP_USE_BDDP, boolValue = true, |
| 140 | label = "Use BDDP for link discovery") | 140 | label = "Use BDDP for link discovery") |
| 141 | - private boolean useBDDP = true; | 141 | + private boolean useBddp = true; |
| 142 | 142 | ||
| 143 | private static final String PROP_PROBE_RATE = "probeRate"; | 143 | private static final String PROP_PROBE_RATE = "probeRate"; |
| 144 | private static final int DEFAULT_PROBE_RATE = 3_000; | 144 | private static final int DEFAULT_PROBE_RATE = 3_000; |
| ... | @@ -177,7 +177,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { | ... | @@ -177,7 +177,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { |
| 177 | /** | 177 | /** |
| 178 | * Creates an OpenFlow link provider. | 178 | * Creates an OpenFlow link provider. |
| 179 | */ | 179 | */ |
| 180 | - public LLDPLinkProvider() { | 180 | + public LldpLinkProvider() { |
| 181 | super(new ProviderId("lldp", PROVIDER_NAME)); | 181 | super(new ProviderId("lldp", PROVIDER_NAME)); |
| 182 | } | 182 | } |
| 183 | 183 | ||
| ... | @@ -222,7 +222,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { | ... | @@ -222,7 +222,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { |
| 222 | } catch (NumberFormatException e) { | 222 | } catch (NumberFormatException e) { |
| 223 | log.warn("Component configuration had invalid values", e); | 223 | log.warn("Component configuration had invalid values", e); |
| 224 | newEnabled = enabled; | 224 | newEnabled = enabled; |
| 225 | - newUseBddp = useBDDP; | 225 | + newUseBddp = useBddp; |
| 226 | newProbeRate = probeRate; | 226 | newProbeRate = probeRate; |
| 227 | newStaleLinkAge = staleLinkAge; | 227 | newStaleLinkAge = staleLinkAge; |
| 228 | newLldpSuppression = lldpSuppression; | 228 | newLldpSuppression = lldpSuppression; |
| ... | @@ -231,7 +231,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { | ... | @@ -231,7 +231,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { |
| 231 | boolean wasEnabled = enabled; | 231 | boolean wasEnabled = enabled; |
| 232 | 232 | ||
| 233 | enabled = newEnabled; | 233 | enabled = newEnabled; |
| 234 | - useBDDP = newUseBddp; | 234 | + useBddp = newUseBddp; |
| 235 | probeRate = newProbeRate; | 235 | probeRate = newProbeRate; |
| 236 | staleLinkAge = newStaleLinkAge; | 236 | staleLinkAge = newStaleLinkAge; |
| 237 | lldpSuppression = newLldpSuppression; | 237 | lldpSuppression = newLldpSuppression; |
| ... | @@ -250,7 +250,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { | ... | @@ -250,7 +250,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { |
| 250 | } | 250 | } |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | - log.info(FORMAT, enabled, useBDDP, probeRate, staleLinkAge, lldpSuppression); | 253 | + log.info(FORMAT, enabled, useBddp, probeRate, staleLinkAge, lldpSuppression); |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | /** | 256 | /** |
| ... | @@ -418,7 +418,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { | ... | @@ -418,7 +418,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { |
| 418 | packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId); | 418 | packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId); |
| 419 | 419 | ||
| 420 | selector.matchEthType(TYPE_BSN); | 420 | selector.matchEthType(TYPE_BSN); |
| 421 | - if (useBDDP) { | 421 | + if (useBddp) { |
| 422 | packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId); | 422 | packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId); |
| 423 | } else { | 423 | } else { |
| 424 | packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId); | 424 | packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId); |
| ... | @@ -534,7 +534,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { | ... | @@ -534,7 +534,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { |
| 534 | return; | 534 | return; |
| 535 | } | 535 | } |
| 536 | 536 | ||
| 537 | - if (ld.handleLLDP(context)) { | 537 | + if (ld.handleLldp(context)) { |
| 538 | context.block(); | 538 | context.block(); |
| 539 | } | 539 | } |
| 540 | } | 540 | } |
| ... | @@ -624,8 +624,8 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { | ... | @@ -624,8 +624,8 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { |
| 624 | } | 624 | } |
| 625 | 625 | ||
| 626 | @Override | 626 | @Override |
| 627 | - public boolean useBDDP() { | 627 | + public boolean useBddp() { |
| 628 | - return useBDDP; | 628 | + return useBddp; |
| 629 | } | 629 | } |
| 630 | 630 | ||
| 631 | @Override | 631 | @Override | ... | ... |
| ... | @@ -72,7 +72,7 @@ import java.util.concurrent.CompletableFuture; | ... | @@ -72,7 +72,7 @@ import java.util.concurrent.CompletableFuture; |
| 72 | import static org.easymock.EasyMock.*; | 72 | import static org.easymock.EasyMock.*; |
| 73 | import static org.junit.Assert.*; | 73 | import static org.junit.Assert.*; |
| 74 | 74 | ||
| 75 | -public class LLDPLinkProviderTest { | 75 | +public class LldpLinkProviderTest { |
| 76 | 76 | ||
| 77 | private static final DeviceId DID1 = DeviceId.deviceId("of:0000000000000001"); | 77 | private static final DeviceId DID1 = DeviceId.deviceId("of:0000000000000001"); |
| 78 | private static final DeviceId DID2 = DeviceId.deviceId("of:0000000000000002"); | 78 | private static final DeviceId DID2 = DeviceId.deviceId("of:0000000000000002"); |
| ... | @@ -83,7 +83,7 @@ public class LLDPLinkProviderTest { | ... | @@ -83,7 +83,7 @@ public class LLDPLinkProviderTest { |
| 83 | private static Port pd3; | 83 | private static Port pd3; |
| 84 | private static Port pd4; | 84 | private static Port pd4; |
| 85 | 85 | ||
| 86 | - private final LLDPLinkProvider provider = new LLDPLinkProvider(); | 86 | + private final LldpLinkProvider provider = new LldpLinkProvider(); |
| 87 | private final TestLinkRegistry linkRegistry = new TestLinkRegistry(); | 87 | private final TestLinkRegistry linkRegistry = new TestLinkRegistry(); |
| 88 | private final TestLinkService linkService = new TestLinkService(); | 88 | private final TestLinkService linkService = new TestLinkService(); |
| 89 | private final TestPacketService packetService = new TestPacketService(); | 89 | private final TestPacketService packetService = new TestPacketService(); |
| ... | @@ -159,7 +159,7 @@ public class LLDPLinkProviderTest { | ... | @@ -159,7 +159,7 @@ public class LLDPLinkProviderTest { |
| 159 | 159 | ||
| 160 | // update device in stub DeviceService with suppression config | 160 | // update device in stub DeviceService with suppression config |
| 161 | deviceService.putDevice(device(DID3, DefaultAnnotations.builder() | 161 | deviceService.putDevice(device(DID3, DefaultAnnotations.builder() |
| 162 | - .set(LLDPLinkProvider.NO_LLDP, "true") | 162 | + .set(LldpLinkProvider.NO_LLDP, "true") |
| 163 | .build())); | 163 | .build())); |
| 164 | deviceListener.event(deviceEvent(DeviceEvent.Type.DEVICE_UPDATED, DID3)); | 164 | deviceListener.event(deviceEvent(DeviceEvent.Type.DEVICE_UPDATED, DID3)); |
| 165 | 165 | ||
| ... | @@ -207,7 +207,7 @@ public class LLDPLinkProviderTest { | ... | @@ -207,7 +207,7 @@ public class LLDPLinkProviderTest { |
| 207 | 207 | ||
| 208 | // add device in stub DeviceService with suppression configured | 208 | // add device in stub DeviceService with suppression configured |
| 209 | deviceService.putDevice(device(DID3, DefaultAnnotations.builder() | 209 | deviceService.putDevice(device(DID3, DefaultAnnotations.builder() |
| 210 | - .set(LLDPLinkProvider.NO_LLDP, "true") | 210 | + .set(LldpLinkProvider.NO_LLDP, "true") |
| 211 | .build())); | 211 | .build())); |
| 212 | deviceListener.event(deviceEvent(DeviceEvent.Type.DEVICE_ADDED, DID3)); | 212 | deviceListener.event(deviceEvent(DeviceEvent.Type.DEVICE_ADDED, DID3)); |
| 213 | 213 | ||
| ... | @@ -249,7 +249,7 @@ public class LLDPLinkProviderTest { | ... | @@ -249,7 +249,7 @@ public class LLDPLinkProviderTest { |
| 249 | final long portno3 = 3L; | 249 | final long portno3 = 3L; |
| 250 | final Port port3 = port(DID3, portno3, true, | 250 | final Port port3 = port(DID3, portno3, true, |
| 251 | DefaultAnnotations.builder() | 251 | DefaultAnnotations.builder() |
| 252 | - .set(LLDPLinkProvider.NO_LLDP, "true") | 252 | + .set(LldpLinkProvider.NO_LLDP, "true") |
| 253 | .build()); | 253 | .build()); |
| 254 | deviceService.putPorts(DID3, port3); | 254 | deviceService.putPorts(DID3, port3); |
| 255 | deviceListener.event(portEvent(DeviceEvent.Type.PORT_ADDED, DID3, port3)); | 255 | deviceListener.event(portEvent(DeviceEvent.Type.PORT_ADDED, DID3, port3)); | ... | ... |
-
Please register or login to post a comment