本文整理匯總了Java中org.onosproject.ovsdb.rfc.table.Interface類的典型用法代碼示例。如果您正苦於以下問題:Java Interface類的具體用法?Java Interface怎麽用?Java Interface使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Interface類屬於org.onosproject.ovsdb.rfc.table包,在下文中一共展示了Interface類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handlePortInsertTable
import org.onosproject.ovsdb.rfc.table.Interface; //導入依賴的package包/類
/**
* Handles port insert.
*
* @param tableName ovsdb table interface
* @param portRow row of port
* @return insert, empty if null
*/
private Insert handlePortInsertTable(String tableName, Row portRow) {
DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
TableSchema portTableSchema = dbSchema
.getTableSchema(OvsdbConstant.PORT);
ColumnSchema portColumnSchema = portTableSchema.getColumnSchema("name");
String portName = (String) portRow.getColumn(portColumnSchema.name()).data();
Interface inf = (Interface) TableGenerator
.createTable(dbSchema, OvsdbTable.INTERFACE);
inf.setName(portName);
TableSchema intfTableSchema = dbSchema
.getTableSchema(OvsdbConstant.INTERFACE);
Insert insert = new Insert(intfTableSchema, OvsdbConstant.INTERFACE,
inf.getRow());
return insert;
}
示例2: getOvsdbPort
import org.onosproject.ovsdb.rfc.table.Interface; //導入依賴的package包/類
private OvsdbPort getOvsdbPort(Row row) {
DatabaseSchema dbSchema = getDatabaseSchema(OvsdbConstant.DATABASENAME);
Interface intf = (Interface) TableGenerator
.getTable(dbSchema, row, OvsdbTable.INTERFACE);
if (intf == null) {
return null;
}
long ofPort = getOfPort(intf);
String portName = intf.getName();
if ((ofPort < 0) || (portName == null)) {
return null;
}
OvsdbPort ovsdbPort = new OvsdbPort(new OvsdbPortNumber(ofPort),
new OvsdbPortName(portName));
return ovsdbPort;
}
示例3: getIfaceid
import org.onosproject.ovsdb.rfc.table.Interface; //導入依賴的package包/類
private String getIfaceid(Interface intf) {
OvsdbMap ovsdbMap = (OvsdbMap) intf.getExternalIdsColumn().data();
@SuppressWarnings("unchecked")
Map<String, String> externalIds = ovsdbMap.map();
if (externalIds.isEmpty()) {
log.warn("The external_ids is null");
return null;
}
String ifaceid = externalIds
.get(OvsdbConstant.EXTERNAL_ID_INTERFACE_ID);
if (ifaceid == null) {
log.warn("The ifaceid is null");
return null;
}
return ifaceid;
}
示例4: getMacAndIfaceid
import org.onosproject.ovsdb.rfc.table.Interface; //導入依賴的package包/類
/**
* Gets mac and iface from the table Interface.
*
* @param intf Interface instance
* @return attachedMac, ifaceid
*/
private String[] getMacAndIfaceid(Interface intf) {
OvsdbMap ovsdbMap = (OvsdbMap) intf.getExternalIdsColumn().data();
@SuppressWarnings("unchecked")
Map<String, String> externalIds = ovsdbMap.map();
if (externalIds == null) {
log.warn("The external_ids is null");
return null;
}
String attachedMac = externalIds.get(OvsdbConstant.EXTERNAL_ID_VM_MAC);
if (attachedMac == null) {
log.debug("The attachedMac is null"); //FIXME why always null?
return null;
}
String ifaceid = externalIds
.get(OvsdbConstant.EXTERNAL_ID_INTERFACE_ID);
if (ifaceid == null) {
log.warn("The ifaceid is null");
return null;
}
return new String[]{attachedMac, ifaceid};
}
示例5: getInterfacebyPort
import org.onosproject.ovsdb.rfc.table.Interface; //導入依賴的package包/類
private Interface getInterfacebyPort(String portUuid, String portName) {
DatabaseSchema dbSchema = schema.get(DATABASENAME);
Row portRow = getRow(DATABASENAME, PORT, portUuid);
Port port = (Port) TableGenerator.getTable(dbSchema, portRow,
OvsdbTable.PORT);
if (port == null) {
return null;
}
OvsdbSet setInterfaces = (OvsdbSet) port.getInterfacesColumn().data();
Set<Uuid> interfaces = setInterfaces.set();
return interfaces.stream().map(intf -> (Interface) TableGenerator
.getTable(dbSchema, getRow(DATABASENAME,
INTERFACE, intf.value()), OvsdbTable.INTERFACE))
.filter(intf -> Objects.nonNull(intf) && portName.equalsIgnoreCase(intf.getName()))
.findFirst().orElse(null);
}
示例6: getInterfaceUuid
import org.onosproject.ovsdb.rfc.table.Interface; //導入依賴的package包/類
@Override
public String getInterfaceUuid(String portUuid, String portName) {
DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
Row portRow = getRow(OvsdbConstant.DATABASENAME, OvsdbConstant.PORT,
portUuid);
Port port = (Port) TableGenerator.getTable(dbSchema, portRow,
OvsdbTable.PORT);
if (port != null) {
OvsdbSet setInterfaces = (OvsdbSet) port.getInterfacesColumn().data();
@SuppressWarnings("unchecked")
Set<Uuid> interfaces = setInterfaces.set();
if (interfaces == null || interfaces.size() == 0) {
log.warn("The interface uuid is null");
return null;
}
for (Uuid uuid : interfaces) {
Row intfRow = getRow(OvsdbConstant.DATABASENAME,
OvsdbConstant.INTERFACE, uuid.value());
Interface intf = (Interface) TableGenerator
.getTable(dbSchema, intfRow, OvsdbTable.INTERFACE);
if (intf != null && portName.equalsIgnoreCase(intf.getName())) {
return uuid.value();
}
}
}
return null;
}
示例7: getOfPort
import org.onosproject.ovsdb.rfc.table.Interface; //導入依賴的package包/類
private long getOfPort(Interface intf) {
OvsdbSet ofPortSet = (OvsdbSet) intf.getOpenFlowPortColumn().data();
@SuppressWarnings("unchecked")
Set<Integer> ofPorts = ofPortSet.set();
while (ofPorts == null || ofPorts.size() <= 0) {
log.debug("The ofport is null in {}", intf.getName());
return -1;
}
// return (long) ofPorts.toArray()[0];
Iterator<Integer> it = ofPorts.iterator();
return Long.parseLong(it.next().toString());
}
示例8: getLocalPorts
import org.onosproject.ovsdb.rfc.table.Interface; //導入依賴的package包/類
@Override
public Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids) {
Set<OvsdbPort> ovsdbPorts = new HashSet<OvsdbPort>();
OvsdbTableStore tableStore = getTableStore(OvsdbConstant.DATABASENAME);
if (tableStore == null) {
return null;
}
OvsdbRowStore rowStore = tableStore.getRows(OvsdbConstant.INTERFACE);
if (rowStore == null) {
return null;
}
ConcurrentMap<String, Row> rows = rowStore.getRowStore();
for (String uuid : rows.keySet()) {
Row row = getRow(OvsdbConstant.DATABASENAME,
OvsdbConstant.INTERFACE, uuid);
DatabaseSchema dbSchema = getDatabaseSchema(OvsdbConstant.DATABASENAME);
Interface intf = (Interface) TableGenerator
.getTable(dbSchema, row, OvsdbTable.INTERFACE);
if (intf == null || getIfaceid(intf) == null) {
continue;
}
String portName = intf.getName();
Set<String> ifaceidSet = Sets.newHashSet(ifaceids);
if (portName.startsWith("vxlan")
|| !ifaceidSet.contains(getIfaceid(intf))) {
continue;
}
long ofPort = getOfPort(intf);
if ((ofPort < 0) || (portName == null)) {
continue;
}
OvsdbPort ovsdbPort = new OvsdbPort(new OvsdbPortNumber(ofPort),
new OvsdbPortName(portName));
if (ovsdbPort != null) {
ovsdbPorts.add(ovsdbPort);
}
}
return ovsdbPorts;
}
示例9: dispatchInterfaceEvent
import org.onosproject.ovsdb.rfc.table.Interface; //導入依賴的package包/類
/**
* Dispatches event to the north.
*
* @param clientService OvsdbClientService instance
* @param newRow a new row
* @param oldRow an old 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<IpAddress>(),
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<EventSubject>(eventType,
eventSubject));
}
}
示例10: getOfPort
import org.onosproject.ovsdb.rfc.table.Interface; //導入依賴的package包/類
/**
* Gets ofPorts number from table Interface.
*
* @param intf Interface instance
* @return ofport the ofport number
*/
private long getOfPort(Interface intf) {
OvsdbSet ofPortSet = (OvsdbSet) intf.getOpenFlowPortColumn().data();
@SuppressWarnings("unchecked")
Set<Integer> ofPorts = ofPortSet.set();
while (ofPorts == null || ofPorts.size() <= 0) {
log.debug("The ofport is null in {}", intf.getName());
return -1;
}
Iterator<Integer> it = ofPorts.iterator();
return Long.parseLong(it.next().toString());
}
示例11: handlePortInsertTable
import org.onosproject.ovsdb.rfc.table.Interface; //導入依賴的package包/類
/**
* Handles port insert.
*
* @param portRow row of port
* @return insert, empty if null
*/
private Insert handlePortInsertTable(Row portRow) {
DatabaseSchema dbSchema = schema.get(DATABASENAME);
TableSchema portTableSchema = dbSchema.getTableSchema(PORT);
ColumnSchema portColumnSchema = portTableSchema.getColumnSchema("name");
String portName = (String) portRow.getColumn(portColumnSchema.name()).data();
Interface inf = (Interface) TableGenerator.createTable(dbSchema, OvsdbTable.INTERFACE);
inf.setName(portName);
TableSchema intfTableSchema = dbSchema.getTableSchema(INTERFACE);
return new Insert(intfTableSchema, INTERFACE, inf.getRow());
}
示例12: getOvsdbPort
import org.onosproject.ovsdb.rfc.table.Interface; //導入依賴的package包/類
private OvsdbPort getOvsdbPort(Row row) {
DatabaseSchema dbSchema = getDatabaseSchema(DATABASENAME);
Interface intf = (Interface) TableGenerator
.getTable(dbSchema, row, OvsdbTable.INTERFACE);
if (intf == null) {
return null;
}
long ofPort = getOfPort(intf);
String portName = intf.getName();
if ((ofPort < 0) || (portName == null)) {
return null;
}
return new OvsdbPort(new OvsdbPortNumber(ofPort), new OvsdbPortName(portName));
}
示例13: getOfPort
import org.onosproject.ovsdb.rfc.table.Interface; //導入依賴的package包/類
private long getOfPort(Interface intf) {
OvsdbSet ofPortSet = (OvsdbSet) intf.getOpenFlowPortColumn().data();
@SuppressWarnings("unchecked")
Set<Integer> ofPorts = ofPortSet.set();
if (ofPorts == null || ofPorts.isEmpty()) {
log.debug("The ofport is null in {}", intf.getName());
return -1;
}
// return (long) ofPorts.toArray()[0];
Iterator<Integer> it = ofPorts.iterator();
return Long.parseLong(it.next().toString());
}
示例14: getLocalPorts
import org.onosproject.ovsdb.rfc.table.Interface; //導入依賴的package包/類
@Override
public Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids) {
Set<OvsdbPort> ovsdbPorts = new HashSet<>();
OvsdbTableStore tableStore = getTableStore(DATABASENAME);
if (tableStore == null) {
return null;
}
OvsdbRowStore rowStore = tableStore.getRows(INTERFACE);
if (rowStore == null) {
return null;
}
ConcurrentMap<String, Row> rows = rowStore.getRowStore();
for (String uuid : rows.keySet()) {
Row row = getRow(DATABASENAME, INTERFACE, uuid);
DatabaseSchema dbSchema = getDatabaseSchema(DATABASENAME);
Interface intf = (Interface) TableGenerator
.getTable(dbSchema, row, OvsdbTable.INTERFACE);
if (intf == null || getIfaceid(intf) == null) {
continue;
}
String portName = intf.getName();
if (portName == null) {
continue;
}
Set<String> ifaceidSet = Sets.newHashSet(ifaceids);
if (portName.startsWith(TYPEVXLAN) || !ifaceidSet.contains(getIfaceid(intf))) {
continue;
}
long ofPort = getOfPort(intf);
if (ofPort < 0) {
continue;
}
ovsdbPorts.add(new OvsdbPort(new OvsdbPortNumber(ofPort),
new OvsdbPortName(portName)));
}
return ovsdbPorts;
}
示例15: getIfaceid
import org.onosproject.ovsdb.rfc.table.Interface; //導入依賴的package包/類
private String getIfaceid(Interface intf) {
OvsdbMap ovsdbMap = (OvsdbMap) intf.getExternalIdsColumn().data();
@SuppressWarnings("unchecked")
Map<String, String> externalIds = ovsdbMap.map();
if (externalIds.isEmpty()) {
log.warn("The external_ids is null");
return null;
}
String ifaceid = externalIds.get(EXTERNAL_ID_INTERFACE_ID);
if (ifaceid == null) {
log.warn("The ifaceid is null");
return null;
}
return ifaceid;
}