use of org.onosproject.segmentrouting.config.SegmentRoutingAppConfig in project trellis-control by opennetworkinglab.
the class AppConfigHandler method init.
/**
* Populates initial vRouter and blackhole rules.
*
* @param deviceId device ID
*/
public void init(DeviceId deviceId) {
SegmentRoutingAppConfig config = srManager.cfgService.getConfig(srManager.appId, SegmentRoutingAppConfig.class);
populateVRouter(deviceId, getMacAddresses(config));
if (config != null) {
config.blackholeIPs().forEach(ipPrefix -> {
srManager.routingRulePopulator.populateDefaultRouteBlackhole(deviceId, ipPrefix);
});
}
}
use of org.onosproject.segmentrouting.config.SegmentRoutingAppConfig in project trellis-control by opennetworkinglab.
the class AppConfigHandler method processAppConfigRemoved.
/**
* Processes Segment Routing App Config removed event.
*
* @param event network config removed event
*/
protected void processAppConfigRemoved(NetworkConfigEvent event) {
log.info("Processing AppConfig CONFIG_REMOVED");
SegmentRoutingAppConfig prevConfig = (SegmentRoutingAppConfig) event.prevConfig().get();
deviceService.getAvailableDevices().forEach(device -> {
revokeVRouter(device.id(), getMacAddresses(prevConfig));
prevConfig.blackholeIPs().forEach(ipPrefix -> {
srManager.routingRulePopulator.removeDefaultRouteBlackhole(device.id(), ipPrefix);
});
});
}
use of org.onosproject.segmentrouting.config.SegmentRoutingAppConfig in project trellis-control by opennetworkinglab.
the class AppConfigHandler method processAppConfigAdded.
/**
* Processes Segment Routing App Config added event.
*
* @param event network config added event
*/
protected void processAppConfigAdded(NetworkConfigEvent event) {
log.info("Processing AppConfig CONFIG_ADDED");
SegmentRoutingAppConfig config = (SegmentRoutingAppConfig) event.config().get();
deviceService.getAvailableDevices().forEach(device -> {
populateVRouter(device.id(), getMacAddresses(config));
config.blackholeIPs().forEach(ipPrefix -> {
srManager.routingRulePopulator.populateDefaultRouteBlackhole(device.id(), ipPrefix);
});
});
}
use of org.onosproject.segmentrouting.config.SegmentRoutingAppConfig in project trellis-control by opennetworkinglab.
the class ArpHandler method processPacketIn.
/**
* Processes incoming ARP packets.
*
* If it is an ARP request to router itself or known hosts,
* then it sends ARP response.
* If it is an ARP request to unknown hosts in its own subnet,
* then it flood the ARP request to the ports.
* If it is an ARP response, then set a flow rule for the host
* and forward any IP packets to the host in the packet buffer to the host.
* <p>
* Note: We handles all ARP packet in, even for those ARP packets between
* hosts in the same subnet.
* For an ARP packet with broadcast destination MAC,
* some switches pipelines will send it to the controller due to table miss,
* other switches will flood the packets directly in the data plane without
* packet in.
* We can deal with both cases.
*
* @param pkt incoming ARP packet and context information
* @param hostService the host service
*/
public void processPacketIn(NeighbourMessageContext pkt, HostService hostService) {
SegmentRoutingAppConfig appConfig = srManager.cfgService.getConfig(srManager.appId, SegmentRoutingAppConfig.class);
if (appConfig != null && appConfig.suppressSubnet().contains(pkt.inPort())) {
// Ignore ARP packets come from suppressed ports
pkt.drop();
return;
}
if (!validateArpSpa(pkt)) {
log.debug("Ignore ARP packet discovered on {} with unexpected src protocol address {}.", pkt.inPort(), pkt.sender().getIp4Address());
pkt.drop();
return;
}
if (pkt.type() == REQUEST) {
handleArpRequest(pkt, hostService);
} else {
handleArpReply(pkt, hostService);
}
}
use of org.onosproject.segmentrouting.config.SegmentRoutingAppConfig in project trellis-control by opennetworkinglab.
the class McastUtils method getRouterMac.
/**
* Get router mac using application config and the connect point.
*
* @param deviceId the device id
* @param port the port number
* @return the router mac if the port is configured, otherwise null
*/
private MacAddress getRouterMac(DeviceId deviceId, PortNumber port) {
// Do nothing if the port is configured as suppressed
ConnectPoint connectPoint = new ConnectPoint(deviceId, port);
SegmentRoutingAppConfig appConfig = srManager.cfgService.getConfig(srManager.appId(), SegmentRoutingAppConfig.class);
if (appConfig != null && appConfig.suppressSubnet().contains(connectPoint)) {
log.info("Ignore suppressed port {}", connectPoint);
return MacAddress.NONE;
}
// Get the router mac using the device configuration
MacAddress routerMac;
try {
routerMac = srManager.deviceConfiguration().getDeviceMac(deviceId);
} catch (DeviceConfigNotFoundException dcnfe) {
log.warn("Failed to get device MAC since the device {} is not configured", deviceId);
return null;
}
return routerMac;
}
Aggregations