use of org.onosproject.net.intf.Interface in project onos by opennetworkinglab.
the class ControlPlaneRedirectManager method updateOspfForwarding.
/**
* Installs or removes OSPF forwarding rules.
*
* @param request provisioning request containing router and interface
* @param install true to create an add objective, false to create a remove
* objective
*/
private void updateOspfForwarding(InterfaceProvisionRequest request, boolean install) {
// TODO IPv6 support has not been implemented yet
Interface intf = request.intf();
log.debug("{} OSPF flows for {}", operation(install), intf);
// OSPF to router
TrafficSelector toSelector = DefaultTrafficSelector.builder().matchInPort(intf.connectPoint().port()).matchEthType(EthType.EtherType.IPV4.ethType().toShort()).matchVlanId(intf.vlan()).matchIPProtocol((byte) OSPF_IP_PROTO).build();
// create nextObjectives for forwarding to the controlPlaneConnectPoint
DeviceId deviceId = intf.connectPoint().deviceId();
PortNumber controlPlanePort = request.controlPlaneConnectPoint().port();
int cpNextId;
if (intf.vlan() == VlanId.NONE) {
cpNextId = modifyNextObjective(deviceId, controlPlanePort, VlanId.vlanId(ASSIGNED_VLAN), true, install);
} else {
cpNextId = modifyNextObjective(deviceId, controlPlanePort, intf.vlan(), false, install);
}
flowObjectiveService.forward(intf.connectPoint().deviceId(), buildForwardingObjective(toSelector, null, cpNextId, install ? request.info().ospfEnabled() : install, ACL_PRIORITY));
}
use of org.onosproject.net.intf.Interface in project onos by opennetworkinglab.
the class ControlPlaneRedirectManagerTest method testAddDevice.
/**
* Tests adding new Device to a openflow router.
*/
@Test
public void testAddDevice() {
ConnectPoint sw1eth4 = new ConnectPoint(DEVICE_ID, PortNumber.portNumber(4));
List<InterfaceIpAddress> interfaceIpAddresses = new ArrayList<>();
interfaceIpAddresses.add(new InterfaceIpAddress(IpAddress.valueOf("192.168.40.101"), IpPrefix.valueOf("192.168.40.0/24")));
interfaceIpAddresses.add(new InterfaceIpAddress(IpAddress.valueOf("2000::ff"), IpPrefix.valueOf("2000::ff/120")));
Interface sw1Eth4 = new Interface(sw1eth4.deviceId().toString(), sw1eth4, interfaceIpAddresses, MacAddress.valueOf("00:00:00:00:00:04"), VlanId.NONE);
interfaces.add(sw1Eth4);
EasyMock.reset(flowObjectiveService);
setUpFlowObjectiveService();
deviceListener.event(new DeviceEvent(DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED, dev3));
verify(flowObjectiveService);
}
use of org.onosproject.net.intf.Interface in project onos by opennetworkinglab.
the class ControlPlaneRedirectManagerTest method testUpdateNetworkConfig.
/**
* Tests adding while updating the networkConfig.
*/
@Test
public void testUpdateNetworkConfig() {
ConnectPoint sw1eth4 = new ConnectPoint(DEVICE_ID, PortNumber.portNumber(4));
List<InterfaceIpAddress> interfaceIpAddresses = new ArrayList<>();
interfaceIpAddresses.add(new InterfaceIpAddress(IpAddress.valueOf("192.168.40.101"), IpPrefix.valueOf("192.168.40.0/24")));
interfaceIpAddresses.add(new InterfaceIpAddress(IpAddress.valueOf("2000::ff"), IpPrefix.valueOf("2000::ff/120")));
Interface sw1Eth4 = new Interface(sw1eth4.deviceId().toString(), sw1eth4, interfaceIpAddresses, MacAddress.valueOf("00:00:00:00:00:04"), VlanId.NONE);
interfaces.add(sw1Eth4);
EasyMock.reset(flowObjectiveService);
setUpFlowObjectiveService();
networkConfigListener.event(new NetworkConfigEvent(Type.CONFIG_UPDATED, dev3, RoutingService.ROUTER_CONFIG_CLASS));
networkConfigService.addListener(networkConfigListener);
verify(flowObjectiveService);
}
use of org.onosproject.net.intf.Interface in project onos by opennetworkinglab.
the class ControlPlaneRedirectManagerTest method testAddInterface.
/**
* Tests adding while updating the networkConfig.
*/
@Test
public void testAddInterface() {
ConnectPoint sw1eth4 = new ConnectPoint(DEVICE_ID, PortNumber.portNumber(4));
List<InterfaceIpAddress> interfaceIpAddresses = new ArrayList<>();
interfaceIpAddresses.add(new InterfaceIpAddress(IpAddress.valueOf("192.168.40.101"), IpPrefix.valueOf("192.168.40.0/24")));
interfaceIpAddresses.add(new InterfaceIpAddress(IpAddress.valueOf("2000::ff"), IpPrefix.valueOf("2000::ff/120")));
Interface sw1Eth4 = new Interface(sw1eth4.deviceId().toString(), sw1eth4, interfaceIpAddresses, MacAddress.valueOf("00:00:00:00:00:04"), VlanId.NONE);
interfaces.add(sw1Eth4);
EasyMock.reset(flowObjectiveService);
expect(flowObjectiveService.allocateNextId()).andReturn(1).anyTimes();
setUpInterfaceConfiguration(sw1Eth4, true);
replay(flowObjectiveService);
interfaceListener.event(new InterfaceEvent(InterfaceEvent.Type.INTERFACE_ADDED, sw1Eth4, 500L));
verify(flowObjectiveService);
}
use of org.onosproject.net.intf.Interface in project onos by opennetworkinglab.
the class FibInstaller method updateMcastFilteringObjective.
/**
* Installs or removes multicast filtering objectives relating to an interface.
*
* @param routerIntf interface to update objectives for
* @param install true to install the objectives, false to remove them
*/
private void updateMcastFilteringObjective(InterfaceProvisionRequest routerIntf, boolean install) {
Interface intf = routerIntf.intf();
VlanId assignedVlan = (egressVlan().equals(VlanId.NONE)) ? VlanId.vlanId(ASSIGNED_VLAN) : egressVlan();
FilteringObjective.Builder fob = DefaultFilteringObjective.builder();
// first add filter for the interface
fob.withKey(Criteria.matchInPort(intf.connectPoint().port())).addCondition(Criteria.matchEthDstMasked(MacAddress.IPV4_MULTICAST, MacAddress.IPV4_MULTICAST_MASK)).addCondition(Criteria.matchVlanId(ingressVlan()));
fob.withPriority(PRIORITY_OFFSET);
TrafficTreatment tt = DefaultTrafficTreatment.builder().pushVlan().setVlanId(assignedVlan).build();
fob.withMeta(tt);
fob.permit().fromApp(fibAppId);
sendFilteringObjective(install, fob, intf);
}
Aggregations