.setDescription(elanInterfaceAdded.getDescription()).build();
@Override public void addStaticMacAddress(String elanInstanceName, String interfaceName, String macAddress) { ElanInterface existingElanInterface = ElanUtils.getElanInterfaceByElanInterfaceName(broker, interfaceName); PhysAddress updateStaticMacAddress = new PhysAddress(macAddress); if (existingElanInterface != null) { List<PhysAddress> existingMacAddress = existingElanInterface.getStaticMacEntries(); if (existingMacAddress.contains(updateStaticMacAddress)) { return; } existingMacAddress.add(updateStaticMacAddress); ElanInterface elanInterface = new ElanInterfaceBuilder().setElanInstanceName(elanInstanceName) .setName(interfaceName).setStaticMacEntries(existingMacAddress) .setDescription(existingElanInterface.getDescription()).setKey(new ElanInterfaceKey(interfaceName)) .build(); MDSALUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, ElanUtils.getElanInterfaceConfigurationDataPathId(interfaceName), elanInterface); } }
@Override public void deleteStaticMacAddress(String elanInstanceName, String interfaceName, String macAddress) throws MacNotFoundException { ElanInterface existingElanInterface = ElanUtils.getElanInterfaceByElanInterfaceName(broker, interfaceName); PhysAddress physAddress = new PhysAddress(macAddress); if (existingElanInterface == null) { return; } List<PhysAddress> existingMacAddress = existingElanInterface.getStaticMacEntries(); if (existingMacAddress.contains(physAddress)) { existingMacAddress.remove(physAddress); ElanInterface elanInterface = new ElanInterfaceBuilder().setElanInstanceName(elanInstanceName) .setName(interfaceName).setStaticMacEntries(existingMacAddress) .setDescription(existingElanInterface.getDescription()).setKey(new ElanInterfaceKey(interfaceName)) .build(); MDSALUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, ElanUtils.getElanInterfaceConfigurationDataPathId(interfaceName), elanInterface); } else { throw new MacNotFoundException("deleteStaticMacAddress did not find MAC: " + macAddress); } }