use of org.onosproject.ovsdb.controller.OvsdbDatapathId in project onos by opennetworkinglab.
the class OvsdbControllerImpl method dispatchInterfaceEvent.
/**
* Dispatches event to the north.
*
* @param clientService OvsdbClientService instance
* @param row a new row
* @param eventType type of event
* @param dbSchema ovsdb database schema
*/
private void dispatchInterfaceEvent(OvsdbClientService clientService, Row row, Type eventType, DatabaseSchema dbSchema) {
long dpid = getDataPathid(clientService, dbSchema);
Interface intf = (Interface) TableGenerator.getTable(dbSchema, row, OvsdbTable.INTERFACE);
if (intf == null) {
return;
}
String portType = (String) intf.getTypeColumn().data();
long localPort = getOfPort(intf);
if (localPort < 0) {
return;
}
String[] macAndIfaceId = getMacAndIfaceid(intf);
if (macAndIfaceId == null) {
return;
}
EventSubject eventSubject = new DefaultEventSubject(MacAddress.valueOf(macAndIfaceId[0]), new HashSet<>(), new OvsdbPortName(intf.getName()), new OvsdbPortNumber(localPort), new OvsdbDatapathId(Long.toString(dpid)), new OvsdbPortType(portType), new OvsdbIfaceId(macAndIfaceId[1]));
for (OvsdbEventListener listener : ovsdbEventListener) {
listener.handle(new OvsdbEvent<>(eventType, eventSubject));
}
}
use of org.onosproject.ovsdb.controller.OvsdbDatapathId in project onos by opennetworkinglab.
the class OvsdbHostProviderTest method portRemoved.
@Test
public void portRemoved() {
DefaultEventSubject eventSubject = new DefaultEventSubject(MAC, null, new OvsdbPortName("portName"), new OvsdbPortNumber(0L), new OvsdbDatapathId("10002"), new OvsdbPortType("vxlan"), new OvsdbIfaceId("102345"));
controller.ovsdbEventListener.handle(new OvsdbEvent<EventSubject>(OvsdbEvent.Type.PORT_REMOVED, eventSubject));
assertEquals("port status unhandled", 1, providerService.removeCount);
}
use of org.onosproject.ovsdb.controller.OvsdbDatapathId in project onos by opennetworkinglab.
the class OvsdbHostProviderTest method portAdded.
@Test
public void portAdded() {
DefaultEventSubject eventSubject = new DefaultEventSubject(MAC, null, new OvsdbPortName("portName"), new OvsdbPortNumber(0L), new OvsdbDatapathId("10002"), new OvsdbPortType("vxlan"), new OvsdbIfaceId("102345"));
controller.ovsdbEventListener.handle(new OvsdbEvent<EventSubject>(OvsdbEvent.Type.PORT_ADDED, eventSubject));
assertNotNull("never went throught the provider service", providerService.added);
}
Aggregations