void setMac(Set<String> mac);
@TypedColumn(name="ifindex", method=MethodType.GETCOLUMN, fromVersion="7.2.1")
- Column<GenericTableSchema, Long> getIfIndexColumn();
+ Column<GenericTableSchema, Set<Long>> getIfIndexColumn();
@TypedColumn(name="ifindex", method=MethodType.SETDATA, fromVersion="7.2.1")
- void setIfIndex(Long ifIndex);
+ void setIfIndex(Set<Long> ifIndex);
@TypedColumn(name="external_ids", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
type string;
}
+ leaf ifindex {
+ description "The ifindex is useful for seamless integration with protocols such as SNMP and sFlow.
+ It is a positive interface index as defined for SNMP MIB-II in RFCs 1213 and 2863 if the interface
+ has one, otherwise 0. It is a read-only column and an integer in the range 0 to 4,294,967,295";
+ type uint32;
+ config false;
+ }
+
leaf interface-type {
description "The type of the OVSDB interface";
type identityref {
new Uuid(interf.getUuid().toString()));
ovsdbTerminationPointBuilder.setInterfaceType(
SouthboundMapper.createInterfaceType(type));
+ updateIfIndex(interf, ovsdbTerminationPointBuilder);
updateOfPort(interf, ovsdbTerminationPointBuilder);
updateOfPortRequest(interf, ovsdbTerminationPointBuilder);
updateInterfaceExternalIds(interf, ovsdbTerminationPointBuilder);
new Uri(SouthboundConstants.QOS_URI_PREFIX + "://" + qosUuid.toString())));
}
+ private void updateIfIndex(final Interface interf,
+ final OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointBuilder) {
+ Set<Long> ifIndexSet = null;
+ try {
+ if (interf.getIfIndexColumn() != null) {
+ ifIndexSet = interf.getIfIndexColumn().getData();
+ }
+ if (ifIndexSet != null && !ifIndexSet.isEmpty()) {
+ for (Long ifIndex : ifIndexSet) {
+ ovsdbTerminationPointBuilder.setIfindex(ifIndex);
+ }
+ }
+ } catch (SchemaVersionMismatchException e) {
+ schemaMismatchLog("ifindex", "Interface", e);
+ }
+ }
+
private void updateOfPort(final Interface interf,
final OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointBuilder) {
MemberModifier.suppress(MemberMatcher.method(OvsdbPortUpdateCommand.class, "updateInterfaceLldp", Interface.class, OvsdbTerminationPointAugmentationBuilder.class));
MemberModifier.suppress(MemberMatcher.method(OvsdbPortUpdateCommand.class, "updateInterfaceBfd", Interface.class, OvsdbTerminationPointAugmentationBuilder.class));
MemberModifier.suppress(MemberMatcher.method(OvsdbPortUpdateCommand.class, "updateInterfaceBfdStatus", Interface.class, OvsdbTerminationPointAugmentationBuilder.class));
+ MemberModifier.suppress(MemberMatcher.method(OvsdbPortUpdateCommand.class, "updateIfIndex", Interface.class, OvsdbTerminationPointAugmentationBuilder.class));
Whitebox.invokeMethod(ovsdbPortUpdateCommand, "updateInterface", interf, OVSDB_INTERFACE_TYPE, ovsdbTerminationPointBuilder);
verify(ovsdbTerminationPointBuilder).setInterfaceUuid(any(Uuid.class));
private static final int OVSDB_ROUNDTRIP_TIMEOUT = 10000;
private static final String FORMAT_STR = "%s_%s_%d";
private static final Version AUTOATTACH_FROM_VERSION = Version.fromString("7.11.2");
+ private static final Version IF_INDEX_FROM_VERSION = Version.fromString("7.2.1");
private static String addressStr;
private static int portNumber;
private static String connectionType;
return tpList.get(index).getAugmentation(OvsdbTerminationPointAugmentation.class);
}
+ @Test
+ public void testCRUDTerminationPointIfIndex() throws InterruptedException {
+ final boolean isOldSchema = schemaVersion.compareTo(IF_INDEX_FROM_VERSION) < 0;
+ Assume.assumeFalse(isOldSchema);
+ ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber);
+
+ // Test create ifIndex
+ try (TestBridge testBridge = new TestBridge(connectionInfo, null, SouthboundITConstants.BRIDGE_NAME, null, true,
+ SouthboundConstants.OVSDB_FAIL_MODE_MAP.inverse().get("secure"),
+ true, SouthboundMapper.createDatapathType("netdev"), null, null, null)) {
+ OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
+ Assert.assertNotNull(bridge);
+ LOG.info("bridge: {}", bridge);
+ NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundUtils.createInstanceIdentifier(
+ connectionInfo, bridge.getBridgeName()));
+ OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
+ createGenericOvsdbTerminationPointAugmentationBuilder();
+ String portName = "testIfIndex";
+ ovsdbTerminationBuilder.setName(portName);
+
+ Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder));
+ InstanceIdentifier<Node> terminationPointIid = getTpIid(connectionInfo, bridge);
+ Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid);
+ Assert.assertNotNull(terminationPointNode);
+
+ // Test read ifIndex
+ List<TerminationPoint> terminationPoints = terminationPointNode.getTerminationPoint();
+ for (TerminationPoint terminationPoint : terminationPoints) {
+ OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
+ terminationPoint.getAugmentation(OvsdbTerminationPointAugmentation.class);
+ if (ovsdbTerminationPointAugmentation.getName().equals(portName)) {
+ Long ifIndex = ovsdbTerminationPointAugmentation.getIfindex();
+ Assert.assertNotNull(ifIndex);
+ LOG.info("ifIndex: {} for the port:{}", ifIndex, portName);
+ }
+ }
+ }
+ }
+
@Test
public void testCRDTerminationPointOfPort() throws InterruptedException {
final Long OFPORT_EXPECTED = 45002L;