use of org.opendaylight.yang.gen.v1.urn.example.data.center.rev180807.device.Start in project netvirt by opendaylight.
the class AlivenessMonitorUtils method startArpMonitoring.
public static void startArpMonitoring(MacEntry macEntry, Long arpMonitorProfileId, AlivenessMonitorService alivenessMonitorService, DataBroker dataBroker, INeutronVpnManager neutronVpnService, IInterfaceManager interfaceManager) {
if (interfaceManager.isExternalInterface(macEntry.getInterfaceName())) {
LOG.debug("ARP monitoring is currently not supported through external interfaces," + "skipping ARP monitoring from interface {} for IP {} (last known MAC {})", macEntry.getInterfaceName(), macEntry.getIpAddress().getHostAddress(), macEntry.getMacAddress());
return;
}
Optional<IpAddress> gatewayIpOptional = VpnUtil.getGatewayIpAddressFromInterface(macEntry.getInterfaceName(), neutronVpnService);
if (!gatewayIpOptional.isPresent()) {
LOG.error("Error while retrieving GatewayIp for interface{}", macEntry.getInterfaceName());
return;
}
final IpAddress gatewayIp = gatewayIpOptional.get();
Optional<String> gatewayMacOptional = VpnUtil.getGWMacAddressFromInterface(macEntry, gatewayIp, dataBroker);
if (!gatewayMacOptional.isPresent()) {
LOG.error("Error while retrieving GatewayMac for interface{}", macEntry.getInterfaceName());
return;
}
final PhysAddress gatewayMac = new PhysAddress(gatewayMacOptional.get());
if (arpMonitorProfileId == null || arpMonitorProfileId.equals(0L)) {
Optional<Long> profileIdOptional = allocateProfile(alivenessMonitorService, ArpConstants.FAILURE_THRESHOLD, ArpConstants.ARP_CACHE_TIMEOUT_MILLIS, ArpConstants.MONITORING_WINDOW, EtherTypes.Arp);
if (!profileIdOptional.isPresent()) {
LOG.error("Error while allocating Profile Id for alivenessMonitorService");
return;
}
arpMonitorProfileId = profileIdOptional.get();
}
IpAddress targetIp = new IpAddress(new Ipv4Address(macEntry.getIpAddress().getHostAddress()));
MonitorStartInput arpMonitorInput = new MonitorStartInputBuilder().setConfig(new ConfigBuilder().setSource(new SourceBuilder().setEndpointType(getSourceEndPointType(macEntry.getInterfaceName(), gatewayIp, gatewayMac)).build()).setDestination(new DestinationBuilder().setEndpointType(getEndPointIpAddress(targetIp)).build()).setMode(MonitoringMode.OneOne).setProfileId(arpMonitorProfileId).build()).build();
try {
Future<RpcResult<MonitorStartOutput>> result = alivenessMonitorService.monitorStart(arpMonitorInput);
RpcResult<MonitorStartOutput> rpcResult = result.get();
long monitorId;
if (rpcResult.isSuccessful()) {
monitorId = rpcResult.getResult().getMonitorId();
createOrUpdateInterfaceMonitorIdMap(monitorId, macEntry);
LOG.trace("Started ARP monitoring with id {}", monitorId);
} else {
LOG.warn("RPC Call to start monitoring returned with Errors {}", rpcResult.getErrors());
}
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Exception when starting monitoring", e);
}
}
use of org.opendaylight.yang.gen.v1.urn.example.data.center.rev180807.device.Start in project netvirt by opendaylight.
the class AclServiceTestBase method newInterfaceWithAap.
@Test
public void newInterfaceWithAap() throws Exception {
LOG.info("newInterfaceWithAap test - start");
// AAP with same MAC and different IP
AllowedAddressPairs aapWithSameMac = buildAap("10.0.0.100/32", PORT_MAC_2);
// AAP with different MAC and different IP
AllowedAddressPairs aapWithDifferentMac = buildAap("10.0.0.101/32", "0D:AA:D8:42:30:A4");
newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1));
newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), Arrays.asList(AAP_PORT_2, aapWithSameMac, aapWithDifferentMac));
dataBrokerUtil.put(new IdentifiedSubnetIpPrefixBuilder().interfaceName(PORT_1).addAllIpPrefixOrAddress(Collections.singletonList(new IpPrefixOrAddress(SUBNET_IP_PREFIX_1.toCharArray()))));
dataBrokerUtil.put(new IdentifiedSubnetIpPrefixBuilder().interfaceName(PORT_2).addAllIpPrefixOrAddress(Collections.singletonList(new IpPrefixOrAddress(SUBNET_IP_PREFIX_1.toCharArray()))));
prepareInterfaceWithIcmpAcl();
// When
putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
asyncEventsWaiter.awaitEventsConsumption();
// Then
newInterfaceWithAapCheck();
LOG.info("newInterfaceWithAap test - end");
}
use of org.opendaylight.yang.gen.v1.urn.example.data.center.rev180807.device.Start in project netvirt by opendaylight.
the class AclServiceTestBase method newInterfaceWithIcmpAcl.
@Test
public void newInterfaceWithIcmpAcl() throws Exception {
LOG.info("newInterfaceWithIcmpAcl - start");
newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1));
newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_2));
dataBrokerUtil.put(new IdentifiedSubnetIpPrefixBuilder().interfaceName(PORT_1).addAllIpPrefixOrAddress(Collections.singletonList(new IpPrefixOrAddress(SUBNET_IP_PREFIX_1.toCharArray()))));
dataBrokerUtil.put(new IdentifiedSubnetIpPrefixBuilder().interfaceName(PORT_2).addAllIpPrefixOrAddress(Collections.singletonList(new IpPrefixOrAddress(SUBNET_IP_PREFIX_1.toCharArray()))));
// Given
prepareInterfaceWithIcmpAcl();
// When
putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
asyncEventsWaiter.awaitEventsConsumption();
// Then
newInterfaceWithIcmpAclCheck();
LOG.info("newInterfaceWithIcmpAcl - end");
}
use of org.opendaylight.yang.gen.v1.urn.example.data.center.rev180807.device.Start in project netvirt by opendaylight.
the class AclServiceTestBase method newInterface.
@Test
public void newInterface() throws Exception {
LOG.info("newInterface - start");
newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1));
testInterfaceManager.addInterfaceInfo(newInterfaceInfo("port1"));
dataBrokerUtil.put(new IdentifiedSubnetIpPrefixBuilder().interfaceName("port1").addAllIpPrefixOrAddress(Collections.singletonList(new IpPrefixOrAddress(SUBNET_IP_PREFIX_1.toCharArray()))));
// When
putNewStateInterface(dataBroker, "port1", PORT_MAC_1);
asyncEventsWaiter.awaitEventsConsumption();
// Then
newInterfaceCheck();
LOG.info("newInterface - end");
}
use of org.opendaylight.yang.gen.v1.urn.example.data.center.rev180807.device.Start in project openflowplugin by opendaylight.
the class Activator method onSessionInitialized.
@Override
public void onSessionInitialized(ConsumerContext session) {
SalFlowService flowService = session.getRpcService(SalFlowService.class);
new SimpleDropFirewall(flowService).start();
}
Aggregations