/**
* Check if the first CIDR address is in (or the same as) the second CIDR address.
*/
- private boolean checkCIDRinCIDR(Ip4Prefix cidrAddr1, Ip4Prefix cidrAddr2) {
+ private boolean checkCidrInCidr(Ip4Prefix cidrAddr1, Ip4Prefix cidrAddr2) {
if (cidrAddr2 == null) {
return true;
} else if (cidrAddr1 == null) {
public boolean checkMatch(AclRule r) {
return (this.dstTpPort == r.dstTpPort || r.dstTpPort == 0)
&& (this.ipProto == r.ipProto || r.ipProto == 0)
- && (checkCIDRinCIDR(this.srcIp(), r.srcIp()))
- && (checkCIDRinCIDR(this.dstIp(), r.dstIp()));
+ && (checkCidrInCidr(this.srcIp(), r.srcIp()))
+ && (checkCidrInCidr(this.dstIp(), r.dstIp()));
}
/**
* @return 200 OK
*/
@DELETE
- public Response clearACL() {
+ public Response clearAcl() {
get(AclService.class).clearAcl();
return Response.ok().build();
}
return rule.build();
}
-}
\ No newline at end of file
+}
/**
* Checks if the given IP address is in the given CIDR address.
*/
- private boolean checkIpInCIDR(Ip4Address ip, Ip4Prefix cidr) {
+ private boolean checkIpInCidr(Ip4Address ip, Ip4Prefix cidr) {
int offset = 32 - cidr.prefixLength();
int cidrPrefix = cidr.address().toInt();
int ipIntValue = ip.toInt();
DeviceId deviceId = event.subject().location().deviceId();
for (IpAddress address : event.subject().ipAddresses()) {
if ((rule.srcIp() != null) ?
- (checkIpInCIDR(address.getIp4Address(), rule.srcIp())) :
- (checkIpInCIDR(address.getIp4Address(), rule.dstIp()))) {
+ (checkIpInCidr(address.getIp4Address(), rule.srcIp())) :
+ (checkIpInCidr(address.getIp4Address(), rule.dstIp()))) {
if (!aclStore.checkIfRuleWorksInDevice(rule.id(), deviceId)) {
List<RuleId> allowingRuleList = aclStore
.getAllowingRuleByDenyingRule(rule.id());
if (allowingRuleList != null) {
for (RuleId allowingRuleId : allowingRuleList) {
- generateACLFlow(aclStore.getAclRule(allowingRuleId), deviceId);
+ generateAclFlow(aclStore.getAclRule(allowingRuleId), deviceId);
}
}
- generateACLFlow(rule, deviceId);
+ generateAclFlow(rule, deviceId);
}
}
}
if (cidrAddr.prefixLength() != 32) {
for (Host h : hosts) {
for (IpAddress a : h.ipAddresses()) {
- if (checkIpInCIDR(a.getIp4Address(), cidrAddr)) {
+ if (checkIpInCidr(a.getIp4Address(), cidrAddr)) {
deviceIdSet.add(h.location().deviceId());
}
}
} else {
for (Host h : hosts) {
for (IpAddress a : h.ipAddresses()) {
- if (checkIpInCIDR(a.getIp4Address(), cidrAddr)) {
+ if (checkIpInCidr(a.getIp4Address(), cidrAddr)) {
deviceIdSet.add(h.location().deviceId());
return deviceIdSet;
}
List<RuleId> allowingRuleList = aclStore.getAllowingRuleByDenyingRule(rule.id());
if (allowingRuleList != null) {
for (RuleId allowingRuleId : allowingRuleList) {
- generateACLFlow(aclStore.getAclRule(allowingRuleId), deviceId);
+ generateAclFlow(aclStore.getAclRule(allowingRuleId), deviceId);
}
}
- generateACLFlow(rule, deviceId);
+ generateAclFlow(rule, deviceId);
}
}
* Generates ACL flow rule according to ACL rule
* and install it into related device.
*/
- private void generateACLFlow(AclRule rule, DeviceId deviceId) {
+ private void generateAclFlow(AclRule rule, DeviceId deviceId) {
if (rule == null || aclStore.checkIfRuleWorksInDevice(rule.id(), deviceId)) {
return;
}
if (((ICMP) ipv4.getPayload()).getIcmpType() == ICMP.TYPE_ECHO_REQUEST &&
ipMatches) {
- sendICMPResponse(ethernet, connectPoint);
+ sendIcmpResponse(ethernet, connectPoint);
}
}
- private void sendICMPResponse(Ethernet icmpRequest, ConnectPoint outport) {
+ private void sendIcmpResponse(Ethernet icmpRequest, ConnectPoint outport) {
Ethernet icmpReplyEth = new Ethernet();
removeVlan(vlan.vlan());
if (vlan.iptv()) {
- provisionIPTV();
+ provisionIpTv();
}
vlan.ports().forEach(cp -> {
}
//FIXME: pass iptv vlan in here.
- private void provisionIPTV() {
+ private void provisionIpTv() {
TrafficSelector ipTvUp = DefaultTrafficSelector.builder()
.matchVlanId(VlanId.vlanId((short) 7))
.matchInPort(PortNumber.portNumber(2))
*/
package org.onosproject.optical.testapp;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.HashMap;
-import java.util.Map;
-
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onlab.packet.Ethernet;
+import org.onlab.packet.MplsLabel;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.net.Device;
import org.onosproject.net.flow.FlowRuleService;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
-import org.onlab.packet.Ethernet;
-import org.onlab.packet.MplsLabel;
import org.slf4j.Logger;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
/**
* Sample reactive forwarding application.
*/
//@Component(immediate = true)
-public class MPLSForwarding {
+public class MplsForwarding {
private final Logger log = getLogger(getClass());
/**
* Simple demo api interface.
*/
-public interface DemoAPI {
+public interface DemoApi {
enum InstallType { MESH, RANDOM }
*/
@Component(immediate = true)
@Service
-public class DemoInstaller implements DemoAPI {
+public class DemoInstaller implements DemoApi {
private final Logger log = getLogger(getClass());
public Response flowTest(InputStream input) throws IOException {
ObjectMapper mapper = new ObjectMapper();
JsonNode cfg = mapper.readTree(input);
- DemoAPI demo = get(DemoAPI.class);
+ DemoApi demo = get(DemoApi.class);
return Response.ok(demo.flowTest(Optional.ofNullable(cfg)).toString()).build();
}
}
- DemoAPI.InstallType type = DemoAPI.InstallType.valueOf(
+ DemoApi.InstallType type = DemoApi.InstallType.valueOf(
cfg.get("type").asText().toUpperCase());
- DemoAPI demo = get(DemoAPI.class);
+ DemoApi demo = get(DemoApi.class);
demo.setup(type, Optional.ofNullable(cfg.get("runParams")));
return Response.ok(mapper.createObjectNode().toString()).build();
@Produces(MediaType.APPLICATION_JSON)
public Response tearDown() {
ObjectMapper mapper = new ObjectMapper();
- DemoAPI demo = get(DemoAPI.class);
+ DemoApi demo = get(DemoApi.class);
demo.tearDown();
return Response.ok(mapper.createObjectNode().toString()).build();
}
*/
package org.onosproject.cli.net;
-import static com.google.common.base.Strings.isNullOrEmpty;
-import static org.onosproject.net.flow.DefaultTrafficTreatment.builder;
-
-import java.util.LinkedList;
-import java.util.List;
-
import org.apache.karaf.shell.commands.Option;
import org.onlab.packet.Ip6Address;
import org.onlab.packet.IpAddress;
import org.onosproject.net.intent.constraint.PartialFailureConstraint;
import org.onosproject.net.resource.link.BandwidthResource;
+import java.util.LinkedList;
+import java.util.List;
+
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static org.onosproject.net.flow.DefaultTrafficTreatment.builder;
+
/**
* Base class for command line operations for connectivity based intents.
*/
@Option(name = "--ndSLL", description = "IPv6 Neighbor Discovery Source Link-Layer",
required = false, multiValued = false)
- private String ndSLLString = null;
+ private String ndSllString = null;
@Option(name = "--ndTLL", description = "IPv6 Neighbor Discovery Target Link-Layer",
required = false, multiValued = false)
- private String ndTLLString = null;
+ private String ndTllString = null;
@Option(name = "--tcpSrc", description = "Source TCP Port",
required = false, multiValued = false)
selectorBuilder.matchIPv6NDTargetAddress(Ip6Address.valueOf(ndTargetString));
}
- if (!isNullOrEmpty(ndSLLString)) {
- selectorBuilder.matchIPv6NDSourceLinkLayerAddress(MacAddress.valueOf(ndSLLString));
+ if (!isNullOrEmpty(ndSllString)) {
+ selectorBuilder.matchIPv6NDSourceLinkLayerAddress(MacAddress.valueOf(ndSllString));
}
- if (!isNullOrEmpty(ndTLLString)) {
- selectorBuilder.matchIPv6NDTargetLinkLayerAddress(MacAddress.valueOf(ndTLLString));
+ if (!isNullOrEmpty(ndTllString)) {
+ selectorBuilder.matchIPv6NDTargetLinkLayerAddress(MacAddress.valueOf(ndTllString));
}
if (!isNullOrEmpty(srcTcpString)) {
DeviceService deviceService = get(DeviceService.class);\r
FlowStatisticService flowStatsService = get(FlowStatisticService.class);\r
\r
- String deviceURI = getDeviceId(devicePort);\r
- String portURI = getPortNumber(devicePort);\r
+ String deviceUri = getDeviceId(devicePort);\r
+ String portUri = getPortNumber(devicePort);\r
\r
- DeviceId ingressDeviceId = deviceId(deviceURI);\r
+ DeviceId ingressDeviceId = deviceId(deviceUri);\r
PortNumber ingressPortNumber;\r
- if (portURI.length() == 0) {\r
+ if (portUri.length() == 0) {\r
ingressPortNumber = null;\r
} else {\r
- ingressPortNumber = portNumber(portURI);\r
+ ingressPortNumber = portNumber(portUri);\r
}\r
\r
Device device = deviceService.getDevice(ingressDeviceId);\r
if (ingressPortNumber != null) {\r
Port port = deviceService.getPort(ingressDeviceId, ingressPortNumber);\r
if (port == null) {\r
- error("No such port %s on device %s", portURI, ingressDeviceId.uri());\r
+ error("No such port %s on device %s", portUri, ingressDeviceId.uri());\r
return;\r
}\r
}\r
\r
// print show topn head line with type\r
print("deviceId=%s, show TOPN=%s flows, live type=%s, instruction type=%s",\r
- deviceURI,\r
+ deviceUri,\r
Integer.toString(topn),\r
flowLiveType == null ? "ALL" : flowLiveType,\r
instructionType == null ? "ALL" : instructionType);\r
} else if (showAll) { // is true?\r
// print show all head line with type\r
print("deviceId=%s, show ALL flows, live type=%s, instruction type=%s",\r
- deviceURI,\r
+ deviceUri,\r
flowLiveType == null ? "ALL" : flowLiveType,\r
instructionType == null ? "ALL" : instructionType);\r
if (ingressPortNumber == null) {\r
}\r
} else { // if (showSummary == true) //always is true\r
// print show summary head line\r
- print("deviceId=%s, show SUMMARY flows", deviceURI);\r
+ print("deviceId=%s, show SUMMARY flows", deviceUri);\r
if (ingressPortNumber == null) {\r
Map<ConnectPoint, SummaryFlowEntryWithLoad> summaryFlowLoadMap =\r
flowStatsService.loadSummary(device);\r
*/
package org.onosproject.cli.net;
-import java.util.Set;
-import java.util.List;
-
+import com.google.common.collect.Lists;
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Link;
+import org.onosproject.net.Path;
import org.onosproject.net.intent.IntentId;
import org.onosproject.net.resource.link.DefaultLinkResourceRequest;
import org.onosproject.net.resource.link.LinkResourceAllocations;
import org.onosproject.net.resource.link.LinkResourceRequest;
import org.onosproject.net.resource.link.LinkResourceService;
import org.onosproject.net.topology.PathService;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.Link;
-import org.onosproject.net.Path;
-import com.google.common.collect.Lists;
+import java.util.List;
+import java.util.Set;
/**
* Commands to test out LinkResourceManager directly.
// default is bandwidth.
@Option(name = "-m", aliases = "--mpls", description = "MPLS resource",
required = false, multiValued = false)
- private boolean isMPLS = false;
+ private boolean isMpls = false;
@Option(name = "-o", aliases = "--optical", description = "Optical resource",
required = false, multiValued = false)
for (Path p : paths) {
List<Link> links = p.links();
LinkResourceRequest.Builder request = null;
- if (isMPLS) {
+ if (isMpls) {
List<Link> nlinks = Lists.newArrayList();
try {
nlinks.addAll(links.subList(1, links.size() - 2));
*/
public DefaultDeviceDescription(DeviceDescription base,
SparseAnnotations... annotations) {
- this(base.deviceURI(), base.type(), base.manufacturer(),
+ this(base.deviceUri(), base.type(), base.manufacturer(),
base.hwVersion(), base.swVersion(), base.serialNumber(),
base.chassisId(), annotations);
}
* @param annotations Annotations to use.
*/
public DefaultDeviceDescription(DeviceDescription base, Type type, SparseAnnotations... annotations) {
- this(base.deviceURI(), type, base.manufacturer(),
+ this(base.deviceUri(), type, base.manufacturer(),
base.hwVersion(), base.swVersion(), base.serialNumber(),
base.chassisId(), annotations);
}
@Override
- public URI deviceURI() {
+ public URI deviceUri() {
return uri;
}
*
* @return provider specific URI for the device
*/
- URI deviceURI();
+ URI deviceUri();
/**
* Returns the type of the infrastructure device.
public void basics() {
DeviceDescription device =
new DefaultDeviceDescription(DURI, SWITCH, MFR, HW, SW, SN, CID);
- assertEquals("incorrect uri", DURI, device.deviceURI());
+ assertEquals("incorrect uri", DURI, device.deviceUri());
assertEquals("incorrect type", SWITCH, device.type());
assertEquals("incorrect manufacturer", MFR, device.manufacturer());
assertEquals("incorrect hw", HW, device.hwVersion());
}
@Test(expected = IOException.class)
- public void badXML() throws IOException {
+ public void badXml() throws IOException {
XmlDriverLoader loader = new XmlDriverLoader(getClass().getClassLoader());
loader.loadDrivers(getClass().getResourceAsStream("drivers.bad.xml"), null);
}
driver.createBehaviour(new DefaultDriverData(driver, DEVICE_ID), TestBehaviour.class);
}
-}
\ No newline at end of file
+}
}
@Test
- public void swEpisodeII() {
+ public void swEpisodeIi() {
assertTrue("r2d2 c3po",
cmp.compare(SmallStarWars.R2D2, SmallStarWars.C3PO) > 0);
}
@Test
- public void swEpisodeIII() {
+ public void swEpisodeIii() {
assertTrue("luke c3po",
cmp.compare(SmallStarWars.LUKE, SmallStarWars.C3PO) > 0);
}
@Test
- public void swEpisodeIV() {
+ public void swEpisodeIv() {
assertTrue("c3po luke",
cmp.compare(SmallStarWars.C3PO, SmallStarWars.LUKE) < 0);
}
}
@Test
- public void swEpisodeVI() {
+ public void swEpisodeVi() {
assertTrue("r2d2 luke",
cmp.compare(SmallStarWars.R2D2, SmallStarWars.LUKE) < 0);
}
import org.onlab.graph.DisjointPathPair;
import org.onlab.graph.GraphPathSearch;
import org.onlab.graph.GraphPathSearch.Result;
-import org.onlab.graph.SRLGGraphSearch;
+import org.onlab.graph.SrlgGraphSearch;
import org.onlab.graph.SuurballeGraphSearch;
import org.onlab.graph.TarjanGraphSearch;
-import org.onlab.graph.TarjanGraphSearch.SCCResult;
+import org.onlab.graph.TarjanGraphSearch.SccResult;
import org.onosproject.net.AbstractModel;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DefaultDisjointPath;
private final TopologyGraph graph;
private final LinkWeight weight;
- private final Supplier<SCCResult<TopologyVertex, TopologyEdge>> clusterResults;
+ private final Supplier<SccResult<TopologyVertex, TopologyEdge>> clusterResults;
private final Supplier<ImmutableMap<ClusterId, TopologyCluster>> clusters;
private final Supplier<ImmutableSet<ConnectPoint>> infrastructurePoints;
private final Supplier<ImmutableSetMultimap<ClusterId, ConnectPoint>> broadcastSets;
return ImmutableSet.of();
}
- SRLGGraphSearch<TopologyVertex, TopologyEdge> srlg = new SRLGGraphSearch<>(riskProfile);
+ SrlgGraphSearch<TopologyVertex, TopologyEdge> srlg = new SrlgGraphSearch<>(riskProfile);
GraphPathSearch.Result<TopologyVertex, TopologyEdge> result =
srlg.search(graph, srcV, dstV, weight, ALL_PATHS);
ImmutableSet.Builder<DisjointPath> builder = ImmutableSet.builder();
// Searches for SCC clusters in the network topology graph using Tarjan
// algorithm.
- private SCCResult<TopologyVertex, TopologyEdge> searchForClusters() {
+ private SccResult<TopologyVertex, TopologyEdge> searchForClusters() {
return TARJAN.search(graph, new NoIndirectLinksWeight());
}
// Builds the topology clusters and returns the id-cluster bindings.
private ImmutableMap<ClusterId, TopologyCluster> buildTopologyClusters() {
ImmutableMap.Builder<ClusterId, TopologyCluster> clusterBuilder = ImmutableMap.builder();
- SCCResult<TopologyVertex, TopologyEdge> results = clusterResults.get();
+ SccResult<TopologyVertex, TopologyEdge> results = clusterResults.get();
// Extract both vertexes and edges from the results; the lists form
// pairs along the same index.
checkArgument(!providerDescs.isEmpty(), "No Device descriptions supplied");
- ProviderId primary = pickPrimaryPID(providerDescs);
+ ProviderId primary = pickPrimaryPid(providerDescs);
DeviceDescriptions desc = providerDescs.get(primary);
private Port composePort(Device device, PortNumber number,
Map<ProviderId, DeviceDescriptions> descsMap) {
- ProviderId primary = pickPrimaryPID(descsMap);
+ ProviderId primary = pickPrimaryPid(descsMap);
DeviceDescriptions primDescs = descsMap.get(primary);
// if no primary, assume not enabled
// TODO: revisit this default port enabled/disabled behavior
/**
* @return primary ProviderID, or randomly chosen one if none exists
*/
- private ProviderId pickPrimaryPID(Map<ProviderId, DeviceDescriptions> descsMap) {
+ private ProviderId pickPrimaryPid(Map<ProviderId, DeviceDescriptions> descsMap) {
ProviderId fallBackPrimary = null;
for (Entry<ProviderId, DeviceDescriptions> e : descsMap.entrySet()) {
if (!e.getKey().isAncillary()) {
}
SparseAnnotations sa = combine(bdc, descr.annotations());
- return new DefaultDeviceDescription(descr.deviceURI(), type, descr.manufacturer(),
+ return new DefaultDeviceDescription(descr.deviceUri(), type, descr.manufacturer(),
descr.hwVersion(), descr.swVersion(),
descr.serialNumber(), descr.chassisId(), sa);
}
Instruction.Type instType) {\r
checkPermission(STATISTIC_READ);\r
\r
- List<TypedFlowEntryWithLoad> retTFEL = new ArrayList<>();\r
+ List<TypedFlowEntryWithLoad> retTfel = new ArrayList<>();\r
\r
Set<FlowEntry> currentStats;\r
Set<FlowEntry> previousStats;\r
synchronized (flowStatisticStore) {\r
currentStats = flowStatisticStore.getCurrentFlowStatistic(cp);\r
if (currentStats == null) {\r
- return retTFEL;\r
+ return retTfel;\r
}\r
previousStats = flowStatisticStore.getPreviousFlowStatistic(cp);\r
if (previousStats == null) {\r
- return retTFEL;\r
+ return retTfel;\r
}\r
// copy to local flow entry set\r
typedStatistics = new TypedStatistics(currentStats, previousStats);\r
List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap,\r
isAllInstType, instType, TypedFlowEntryWithLoad.shortPollInterval());\r
if (fel.size() > 0) {\r
- retTFEL.addAll(fel);\r
+ retTfel.addAll(fel);\r
}\r
}\r
\r
List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap,\r
isAllInstType, instType, TypedFlowEntryWithLoad.shortPollInterval());\r
if (fel.size() > 0) {\r
- retTFEL.addAll(fel);\r
+ retTfel.addAll(fel);\r
}\r
}\r
\r
List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap,\r
isAllInstType, instType, TypedFlowEntryWithLoad.midPollInterval());\r
if (fel.size() > 0) {\r
- retTFEL.addAll(fel);\r
+ retTfel.addAll(fel);\r
}\r
}\r
\r
List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap,\r
isAllInstType, instType, TypedFlowEntryWithLoad.longPollInterval());\r
if (fel.size() > 0) {\r
- retTFEL.addAll(fel);\r
+ retTfel.addAll(fel);\r
}\r
}\r
\r
List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap,\r
isAllInstType, instType, TypedFlowEntryWithLoad.avgPollInterval());\r
if (fel.size() > 0) {\r
- retTFEL.addAll(fel);\r
+ retTfel.addAll(fel);\r
}\r
}\r
\r
- return retTFEL;\r
+ return retTfel;\r
}\r
\r
private List<TypedFlowEntryWithLoad> typedFlowEntryLoadByInstInternal(ConnectPoint cp,\r
replay(hostService);
replay(interfaceService);
- Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
- MAC4, SOLICITED_MAC3,
- IP4, IP3);
+ Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ MAC4, SOLICITED_MAC3,
+ IP4, IP3);
proxyArp.reply(ndpRequest, getLocation(5));
assertEquals(1, packetService.packets.size());
- Ethernet ndpReply = buildNDP(ICMP6.NEIGHBOR_ADVERTISEMENT,
- MAC3, MAC4, IP3, IP4);
+ Ethernet ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT,
+ MAC3, MAC4, IP3, IP4);
verifyPacketOut(ndpReply, getLocation(5), packetService.packets.get(0));
}
replay(hostService);
replay(interfaceService);
- Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
- MAC4, SOLICITED_MAC3,
- IP4, IP3);
+ Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ MAC4, SOLICITED_MAC3,
+ IP4, IP3);
proxyArp.reply(ndpRequest, getLocation(NUM_DEVICES));
replay(hostService);
replay(interfaceService);
- Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
- MAC4, SOLICITED_MAC3,
- IP4, IP3);
+ Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ MAC4, SOLICITED_MAC3,
+ IP4, IP3);
proxyArp.reply(ndpRequest, getLocation(NUM_DEVICES));
replay(hostService);
replay(interfaceService);
- Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
- MAC2,
- MacAddress.valueOf("33:33:ff:00:00:01"),
- theirIp,
- ourFirstIp);
+ Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ MAC2,
+ MacAddress.valueOf("33:33:ff:00:00:01"),
+ theirIp,
+ ourFirstIp);
proxyArp.reply(ndpRequest, LOC1);
assertEquals(1, packetService.packets.size());
- Ethernet ndpReply = buildNDP(ICMP6.NEIGHBOR_ADVERTISEMENT,
- firstMac,
- MAC2,
- ourFirstIp,
- theirIp);
+ Ethernet ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT,
+ firstMac,
+ MAC2,
+ ourFirstIp,
+ theirIp);
verifyPacketOut(ndpReply, LOC1, packetService.packets.get(0));
// Test a request for the second address on that port
packetService.packets.clear();
- ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
- MAC2,
- MacAddress.valueOf("33:33:ff:00:00:01"),
- theirIp,
- ourSecondIp);
+ ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ MAC2,
+ MacAddress.valueOf("33:33:ff:00:00:01"),
+ theirIp,
+ ourSecondIp);
proxyArp.reply(ndpRequest, LOC1);
assertEquals(1, packetService.packets.size());
- ndpReply = buildNDP(ICMP6.NEIGHBOR_ADVERTISEMENT,
- secondMac,
- MAC2,
- ourSecondIp,
- theirIp);
+ ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT,
+ secondMac,
+ MAC2,
+ ourSecondIp,
+ theirIp);
verifyPacketOut(ndpReply, LOC1, packetService.packets.get(0));
}
Ip6Address theirIp = Ip6Address.valueOf("1000::ffff");
- Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
- MAC1,
- MacAddress.valueOf("33:33:ff:00:00:01"),
- theirIp,
- Ip6Address.valueOf("3000::1"));
+ Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ MAC1,
+ MacAddress.valueOf("33:33:ff:00:00:01"),
+ theirIp,
+ Ip6Address.valueOf("3000::1"));
proxyArp.reply(ndpRequest, LOC1);
assertEquals(0, packetService.packets.size());
// Request for a valid internal IP address but coming in an external port
packetService.packets.clear();
- ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
- MAC1,
- MacAddress.valueOf("33:33:ff:00:00:01"),
- theirIp,
- IP3);
+ ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ MAC1,
+ MacAddress.valueOf("33:33:ff:00:00:01"),
+ theirIp,
+ IP3);
proxyArp.reply(ndpRequest, LOC1);
assertEquals(0, packetService.packets.size());
}
// This is a request from something inside our network (like a BGP
// daemon) to an external host.
- Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
- ourMac,
- MacAddress.valueOf("33:33:ff:00:00:01"),
- ourIp,
- theirIp);
+ Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ ourMac,
+ MacAddress.valueOf("33:33:ff:00:00:01"),
+ ourIp,
+ theirIp);
proxyArp.reply(ndpRequest, getLocation(5));
assertEquals(1, packetService.packets.size());
replay(hostService);
replay(interfaceService);
- Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
- MAC4, SOLICITED_MAC3,
- IP4, IP3);
+ Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ MAC4, SOLICITED_MAC3,
+ IP4, IP3);
proxyArp.forward(ndpRequest, LOC2);
replay(hostService);
replay(interfaceService);
- Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
- MAC4, SOLICITED_MAC3,
- IP4, IP3);
+ Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+ MAC4, SOLICITED_MAC3,
+ IP4, IP3);
proxyArp.forward(ndpRequest, getLocation(NUM_DEVICES));
* @param dstIp destination IP address
* @return the NDP packet
*/
- private Ethernet buildNDP(byte type, MacAddress srcMac, MacAddress dstMac,
+ private Ethernet buildNdp(byte type, MacAddress srcMac, MacAddress dstMac,
Ip6Address srcIp, Ip6Address dstIp) {
assertThat(type, anyOf(
is(ICMP6.NEIGHBOR_SOLICITATION),
@Activate
public void activate() throws Exception {
ControllerNode localNode = clusterMetadataService.getLocalNode();
- getTLSParameters();
+ getTlsParameters();
super.start(new Endpoint(localNode.ip(), localNode.tcpPort()));
log.info("Started");
}
log.info("Stopped");
}
- private void getTLSParameters() {
+ private void getTlsParameters() {
String tempString = System.getProperty("enableNettyTLS");
- enableNettyTLS = Strings.isNullOrEmpty(tempString) ? TLS_DISABLED : Boolean.parseBoolean(tempString);
- log.info("enableNettyTLS = {}", enableNettyTLS);
- if (enableNettyTLS) {
+ enableNettyTls = Strings.isNullOrEmpty(tempString) ? TLS_DISABLED : Boolean.parseBoolean(tempString);
+ log.info("enableNettyTLS = {}", enableNettyTls);
+ if (enableNettyTls) {
ksLocation = System.getProperty("javax.net.ssl.keyStore");
if (Strings.isNullOrEmpty(ksLocation)) {
- enableNettyTLS = TLS_DISABLED;
+ enableNettyTls = TLS_DISABLED;
return;
}
tsLocation = System.getProperty("javax.net.ssl.trustStore");
if (Strings.isNullOrEmpty(tsLocation)) {
- enableNettyTLS = TLS_DISABLED;
+ enableNettyTls = TLS_DISABLED;
return;
}
ksPwd = System.getProperty("javax.net.ssl.keyStorePassword").toCharArray();
if (MIN_KS_LENGTH > ksPwd.length) {
- enableNettyTLS = TLS_DISABLED;
+ enableNettyTls = TLS_DISABLED;
return;
}
tsPwd = System.getProperty("javax.net.ssl.trustStorePassword").toCharArray();
if (MIN_KS_LENGTH > tsPwd.length) {
- enableNettyTLS = TLS_DISABLED;
+ enableNettyTls = TLS_DISABLED;
return;
}
}
checkArgument(!providerDescs.isEmpty(), "No device descriptions supplied");
- ProviderId primary = pickPrimaryPID(providerDescs);
+ ProviderId primary = pickPrimaryPid(providerDescs);
DeviceDescriptions desc = providerDescs.get(primary);
private Port composePort(Device device, PortNumber number,
Map<ProviderId, DeviceDescriptions> descsMap) {
- ProviderId primary = pickPrimaryPID(descsMap);
+ ProviderId primary = pickPrimaryPid(descsMap);
DeviceDescriptions primDescs = descsMap.get(primary);
// if no primary, assume not enabled
boolean isEnabled = false;
/**
* @return primary ProviderID, or randomly chosen one if none exists
*/
- private ProviderId pickPrimaryPID(
+ private ProviderId pickPrimaryPid(
Map<ProviderId, DeviceDescriptions> providerDescs) {
ProviderId fallBackPrimary = null;
for (Entry<ProviderId, DeviceDescriptions> e : providerDescs.entrySet()) {
private DeviceDescriptions getPrimaryDescriptions(
Map<ProviderId, DeviceDescriptions> providerDescs) {
- ProviderId pid = pickPrimaryPID(providerDescs);
+ ProviderId pid = pickPrimaryPid(providerDescs);
return providerDescs.get(pid);
}
if (expected == actual) {
return;
}
- assertEquals(expected.deviceURI(), actual.deviceURI());
+ assertEquals(expected.deviceUri(), actual.deviceUri());
assertEquals(expected.hwVersion(), actual.hwVersion());
assertEquals(expected.manufacturer(), actual.manufacturer());
assertEquals(expected.serialNumber(), actual.serialNumber());
if (expected == actual) {
return;
}
- assertEquals(expected.deviceURI(), actual.deviceURI());
+ assertEquals(expected.deviceUri(), actual.deviceUri());
assertEquals(expected.hwVersion(), actual.hwVersion());
assertEquals(expected.manufacturer(), actual.manufacturer());
assertEquals(expected.serialNumber(), actual.serialNumber());
DefaultTableStatisticsEntry.class
)
.register(new DefaultApplicationIdSerializer(), DefaultApplicationId.class)
- .register(new URISerializer(), URI.class)
+ .register(new UriSerializer(), URI.class)
.register(new NodeIdSerializer(), NodeId.class)
.register(new ProviderIdSerializer(), ProviderId.class)
.register(new DeviceIdSerializer(), DeviceId.class)
*/
package org.onosproject.store.serializers;
-import java.net.URI;
-
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
+import java.net.URI;
+
/**
* Serializer for {@link URI}.
*/
-public class URISerializer extends Serializer<URI> {
+public class UriSerializer extends Serializer<URI> {
/**
* Creates {@link URI} serializer instance.
*/
- public URISerializer() {
+ public UriSerializer() {
super(false);
}
* while it sends *all* ports (both tap and WDM ports, i.e., OCh and OMS) in the experimenter port desc stats reply.
*
*/
-public class OFOpticalSwitchImplLINC13
+public class OfOpticalSwitchImplLinc13
extends AbstractOpenFlowSwitch implements OpenFlowOpticalSwitch {
private final AtomicBoolean driverHandshakeComplete = new AtomicBoolean(false);
manufacturer="FlowForwarding.org" hwVersion="Unknown"
swVersion="LINC-OE OpenFlow Software Switch 1.1">
<behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver"
- impl="org.onosproject.driver.handshaker.OFOpticalSwitchImplLINC13"/>
+ impl="org.onosproject.driver.handshaker.OfOpticalSwitchImplLinc13"/>
</driver>
<driver name="corsa"
manufacturer="Corsa" hwVersion="Corsa Element" swVersion="2.3.1">
* if one path goes through an edge in risk group 1, the other path will go
* through no edges in risk group 1.
*/
-public class SRLGGraphSearch<V extends Vertex, E extends Edge<V>>
+public class SrlgGraphSearch<V extends Vertex, E extends Edge<V>>
extends AbstractGraphPathSearch<V, E> {
static final int ITERATIONS = 100;
* @param groups the number of disjoint risk groups
* @param grouping map linking edges to integral group assignments
*/
- public SRLGGraphSearch(int groups, Map<E, Integer> grouping) {
+ public SrlgGraphSearch(int groups, Map<E, Integer> grouping) {
numGroups = groups;
riskGrouping = grouping;
}
* @param grouping map linking edges to object group assignments,
* with same-group status linked to equality
*/
- public SRLGGraphSearch(Map<E, Object> grouping) {
+ public SrlgGraphSearch(Map<E, Object> grouping) {
if (grouping == null) {
useSuurballe = true;
return;
* </p>
*/
@Override
- public SCCResult<V, E> search(Graph<V, E> graph, EdgeWeight<V, E> weight) {
- SCCResult<V, E> result = new SCCResult<>(graph);
+ public SccResult<V, E> search(Graph<V, E> graph, EdgeWeight<V, E> weight) {
+ SccResult<V, E> result = new SccResult<>(graph);
for (V vertex : graph.getVertexes()) {
VertexData data = result.data(vertex);
if (data == null) {
*/
private VertexData<V> connect(Graph<V, E> graph, V vertex,
EdgeWeight<V, E> weight,
- SCCResult<V, E> result) {
+ SccResult<V, E> result) {
VertexData<V> data = result.addData(vertex);
// Scan through all egress edges of the current vertex.
/**
* Graph search result augmented with SCC vertexData.
*/
- public static final class SCCResult<V extends Vertex, E extends Edge<V>>
+ public static final class SccResult<V extends Vertex, E extends Edge<V>>
implements Result {
private final Graph<V, E> graph;
private final Map<V, VertexData<V>> vertexData = new HashMap<>();
private final List<VertexData<V>> visited = new ArrayList<>();
- private SCCResult(Graph<V, E> graph) {
+ private SccResult(Graph<V, E> graph) {
this.graph = graph;
}
return Collections.unmodifiableSet(edges);
}
- public SCCResult<V, E> build() {
+ public SccResult<V, E> build() {
clusterVertexes = Collections.unmodifiableList(clusterVertexes);
clusterEdges = Collections.unmodifiableList(clusterEdges);
return this;
/**
* Test of the Suurballe backup path algorithm.
*/
-public class SRLGGraphSearchTest extends BreadthFirstSearchTest {
+public class SrlgGraphSearchTest extends BreadthFirstSearchTest {
@Override
protected AbstractGraphPathSearch<TestVertex, TestEdge> graphSearch() {
- return new SRLGGraphSearch<>(null);
+ return new SrlgGraphSearch<>(null);
}
public void setDefaultWeights() {
riskProfile.put(bC, 0);
riskProfile.put(aD, 1);
riskProfile.put(dC, 1);
- SRLGGraphSearch<TestVertex, TestEdge> search = new SRLGGraphSearch<>(2, riskProfile);
+ SrlgGraphSearch<TestVertex, TestEdge> search = new SrlgGraphSearch<>(2, riskProfile);
Set<Path<TestVertex, TestEdge>> paths = search.search(graph, A, C, weight, ALL_PATHS).paths();
System.out.println("\n\n\n" + paths + "\n\n\n");
assertEquals("one disjoint path pair found", 1, paths.size());
riskProfile.put(dC, 1);
riskProfile.put(cE, 2);
riskProfile.put(bE, 3);
- SRLGGraphSearch<TestVertex, TestEdge> search = new SRLGGraphSearch<>(4, riskProfile);
+ SrlgGraphSearch<TestVertex, TestEdge> search = new SrlgGraphSearch<>(4, riskProfile);
search.search(graph, A, E, weight, ALL_PATHS).paths();
}
riskProfile.put(dE, 3);
riskProfile.put(aC, 4);
riskProfile.put(cE, 5);
- SRLGGraphSearch<TestVertex, TestEdge> search = new SRLGGraphSearch<>(6, riskProfile);
+ SrlgGraphSearch<TestVertex, TestEdge> search = new SrlgGraphSearch<>(6, riskProfile);
Set<Path<TestVertex, TestEdge>> paths = search.search(graph, A, E, weight, ALL_PATHS).paths();
assertTrue("> one disjoint path pair found", paths.size() >= 1);
checkIsDisjoint(paths.iterator().next(), riskProfile);
riskProfile.put(bC, 0);
riskProfile.put(aD, 1);
riskProfile.put(dC, 0);
- SRLGGraphSearch<TestVertex, TestEdge> search = new SRLGGraphSearch<>(2, riskProfile);
+ SrlgGraphSearch<TestVertex, TestEdge> search = new SrlgGraphSearch<>(2, riskProfile);
Set<Path<TestVertex, TestEdge>> paths = search.search(graph, A, C, weight, ALL_PATHS).paths();
System.out.println(paths);
assertTrue("no disjoint path pairs found", paths.size() == 0);
riskProfile.put(bC, 0);
riskProfile.put(aD, 1);
riskProfile.put(dC, 0);
- SRLGGraphSearch<TestVertex, TestEdge> search = new SRLGGraphSearch<>(2, riskProfile);
+ SrlgGraphSearch<TestVertex, TestEdge> search = new SrlgGraphSearch<>(2, riskProfile);
Set<Path<TestVertex, TestEdge>> paths = search.search(graph, A, E, weight, ALL_PATHS).paths();
assertTrue("no disjoint path pairs found", paths.size() == 0);
}
import static com.google.common.collect.ImmutableSet.of;
import static org.junit.Assert.assertEquals;
-import static org.onlab.graph.TarjanGraphSearch.SCCResult;
+import static org.onlab.graph.TarjanGraphSearch.SccResult;
/**
* Tarjan graph search tests.
*/
public class TarjanGraphSearchTest extends GraphTest {
- private void validate(SCCResult<TestVertex, TestEdge> result, int cc) {
+ private void validate(SccResult<TestVertex, TestEdge> result, int cc) {
System.out.println("Cluster count: " + result.clusterVertexes().size());
System.out.println("Clusters: " + result.clusterVertexes());
assertEquals("incorrect cluster count", cc, result.clusterCount());
}
- private void validate(SCCResult<TestVertex, TestEdge> result,
+ private void validate(SccResult<TestVertex, TestEdge> result,
int i, int vc, int ec) {
assertEquals("incorrect cluster count", vc, result.clusterVertexes().get(i).size());
assertEquals("incorrect edge count", ec, result.clusterEdges().get(i).size());
public void basic() {
graph = new AdjacencyListsGraph<>(vertexes(), edges());
TarjanGraphSearch<TestVertex, TestEdge> gs = new TarjanGraphSearch<>();
- SCCResult<TestVertex, TestEdge> result = gs.search(graph, null);
+ SccResult<TestVertex, TestEdge> result = gs.search(graph, null);
validate(result, 6);
}
new TestEdge(H, A, 1)));
TarjanGraphSearch<TestVertex, TestEdge> gs = new TarjanGraphSearch<>();
- SCCResult<TestVertex, TestEdge> result = gs.search(graph, null);
+ SccResult<TestVertex, TestEdge> result = gs.search(graph, null);
validate(result, 1);
validate(result, 0, 8, 8);
}
new TestEdge(G, H, 1),
new TestEdge(H, E, 1)));
TarjanGraphSearch<TestVertex, TestEdge> gs = new TarjanGraphSearch<>();
- SCCResult<TestVertex, TestEdge> result = gs.search(graph, null);
+ SccResult<TestVertex, TestEdge> result = gs.search(graph, null);
validate(result, 2);
validate(result, 0, 4, 4);
validate(result, 1, 4, 4);
new TestEdge(H, E, 1),
new TestEdge(B, E, 1)));
TarjanGraphSearch<TestVertex, TestEdge> gs = new TarjanGraphSearch<>();
- SCCResult<TestVertex, TestEdge> result = gs.search(graph, null);
+ SccResult<TestVertex, TestEdge> result = gs.search(graph, null);
validate(result, 2);
validate(result, 0, 4, 4);
validate(result, 1, 4, 4);
new TestEdge(E, B, -1)));
TarjanGraphSearch<TestVertex, TestEdge> gs = new TarjanGraphSearch<>();
- SCCResult<TestVertex, TestEdge> result = gs.search(graph, weight);
+ SccResult<TestVertex, TestEdge> result = gs.search(graph, weight);
validate(result, 2);
validate(result, 0, 4, 4);
validate(result, 1, 4, 4);
}
@Test
- public void testToLongMSB() {
+ public void testToLongMsb() {
String dpidStr = "ca:7c:5e:d1:64:7a:95:9b";
long valid = -3856102927509056101L;
long testLong = HexString.toLong(dpidStr);
*/
package org.onlab.netty;
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.RemovalListener;
+import com.google.common.cache.RemovalNotification;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
+import org.apache.commons.pool.KeyedPoolableObjectFactory;
+import org.apache.commons.pool.impl.GenericKeyedObjectPool;
+import org.onosproject.store.cluster.messaging.Endpoint;
+import org.onosproject.store.cluster.messaging.MessagingService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.TrustManagerFactory;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.KeyStore;
-
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Consumer;
import java.util.function.Function;
-import org.apache.commons.pool.KeyedPoolableObjectFactory;
-import org.apache.commons.pool.impl.GenericKeyedObjectPool;
-import org.onosproject.store.cluster.messaging.Endpoint;
-import org.onosproject.store.cluster.messaging.MessagingService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.RemovalListener;
-import com.google.common.cache.RemovalNotification;
-
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLEngine;
-import javax.net.ssl.TrustManagerFactory;
-
/**
* Implementation of MessagingService based on <a href="http://netty.io/">Netty</a> framework.
*/
private Class<? extends Channel> clientChannelClass;
protected static final boolean TLS_DISABLED = false;
- protected boolean enableNettyTLS = TLS_DISABLED;
+ protected boolean enableNettyTls = TLS_DISABLED;
protected String ksLocation;
protected String tsLocation;
b.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
b.group(serverGroup, clientGroup);
b.channel(serverChannelClass);
- if (enableNettyTLS) {
- b.childHandler(new SSLServerCommunicationChannelInitializer());
+ if (enableNettyTls) {
+ b.childHandler(new SslServerCommunicationChannelInitializer());
} else {
b.childHandler(new OnosCommunicationChannelInitializer());
}
// http://normanmaurer.me/presentations/2014-facebook-eng-netty/slides.html#37.0
bootstrap.channel(clientChannelClass);
bootstrap.option(ChannelOption.SO_KEEPALIVE, true);
- if (enableNettyTLS) {
- bootstrap.handler(new SSLClientCommunicationChannelInitializer());
+ if (enableNettyTls) {
+ bootstrap.handler(new SslClientCommunicationChannelInitializer());
} else {
bootstrap.handler(new OnosCommunicationChannelInitializer());
}
}
}
- private class SSLServerCommunicationChannelInitializer extends ChannelInitializer<SocketChannel> {
+ private class SslServerCommunicationChannelInitializer extends ChannelInitializer<SocketChannel> {
private final ChannelHandler dispatcher = new InboundMessageDispatcher();
private final ChannelHandler encoder = new MessageEncoder();
SSLContext serverContext = SSLContext.getInstance("TLS");
serverContext.init(kmf.getKeyManagers(), tmFactory.getTrustManagers(), null);
- SSLEngine serverSSLEngine = serverContext.createSSLEngine();
+ SSLEngine serverSslEngine = serverContext.createSSLEngine();
- serverSSLEngine.setNeedClientAuth(true);
- serverSSLEngine.setUseClientMode(false);
- serverSSLEngine.setEnabledProtocols(serverSSLEngine.getSupportedProtocols());
- serverSSLEngine.setEnabledCipherSuites(serverSSLEngine.getSupportedCipherSuites());
- serverSSLEngine.setEnableSessionCreation(true);
+ serverSslEngine.setNeedClientAuth(true);
+ serverSslEngine.setUseClientMode(false);
+ serverSslEngine.setEnabledProtocols(serverSslEngine.getSupportedProtocols());
+ serverSslEngine.setEnabledCipherSuites(serverSslEngine.getSupportedCipherSuites());
+ serverSslEngine.setEnableSessionCreation(true);
- channel.pipeline().addLast("ssl", new io.netty.handler.ssl.SslHandler(serverSSLEngine))
+ channel.pipeline().addLast("ssl", new io.netty.handler.ssl.SslHandler(serverSslEngine))
.addLast("encoder", encoder)
.addLast("decoder", new MessageDecoder())
.addLast("handler", dispatcher);
}
- private class SSLClientCommunicationChannelInitializer extends ChannelInitializer<SocketChannel> {
+ private class SslClientCommunicationChannelInitializer extends ChannelInitializer<SocketChannel> {
private final ChannelHandler dispatcher = new InboundMessageDispatcher();
private final ChannelHandler encoder = new MessageEncoder();
SSLContext clientContext = SSLContext.getInstance("TLS");
clientContext.init(kmf.getKeyManagers(), tmFactory.getTrustManagers(), null);
- SSLEngine clientSSLEngine = clientContext.createSSLEngine();
+ SSLEngine clientSslEngine = clientContext.createSSLEngine();
- clientSSLEngine.setUseClientMode(true);
- clientSSLEngine.setEnabledProtocols(clientSSLEngine.getSupportedProtocols());
- clientSSLEngine.setEnabledCipherSuites(clientSSLEngine.getSupportedCipherSuites());
- clientSSLEngine.setEnableSessionCreation(true);
+ clientSslEngine.setUseClientMode(true);
+ clientSslEngine.setEnabledProtocols(clientSslEngine.getSupportedProtocols());
+ clientSslEngine.setEnabledCipherSuites(clientSslEngine.getSupportedCipherSuites());
+ clientSslEngine.setEnableSessionCreation(true);
- channel.pipeline().addLast("ssl", new io.netty.handler.ssl.SslHandler(clientSSLEngine))
+ channel.pipeline().addLast("ssl", new io.netty.handler.ssl.SslHandler(clientSslEngine))
.addLast("encoder", encoder)
.addLast("decoder", new MessageDecoder())
.addLast("handler", dispatcher);
String value = annotations.value("optical.waves").trim();
try {
int numChls = Integer.parseInt(value);
- updateOMSPorts(numChls, src, dst);
+ updateOmsPorts(numChls, src, dst);
} catch (NumberFormatException e) {
log.warn("Invalid channel ({}), can't configure port(s)", value);
return;
}
}
- private void updateOMSPorts(int numChls, ConnectPoint srcCp, ConnectPoint dstCp) {
+ private void updateOmsPorts(int numChls, ConnectPoint srcCp, ConnectPoint dstCp) {
// round down to largest slot that allows numChl channels to fit into C band range
ChannelSpacing chl = null;
Frequency perChl = TOTAL.floorDivision(numChls);