use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.DeviceBuilder in project netvirt by opendaylight.
the class L2gwBuilders method buildL2gw.
public L2gateway buildL2gw(String l2gwName, String deviceName, List<String> intfNames) {
final L2gatewayBuilder l2gatewayBuilder = new L2gatewayBuilder();
String uuid = UUID.nameUUIDFromBytes(l2gwName.getBytes()).toString();
// String tenantUuid = UUID.fromString(ELAN1).toString();
l2gatewayBuilder.setUuid(new Uuid(uuid));
l2gatewayBuilder.setTenantId(new Uuid(ExpectedObjects.ELAN1));
final List<Devices> devices = new ArrayList<>();
final DevicesBuilder deviceBuilder = new DevicesBuilder();
final List<Interfaces> interfaces = new ArrayList<>();
for (String intfName : intfNames) {
final InterfacesBuilder interfacesBuilder = new InterfacesBuilder();
interfacesBuilder.setInterfaceName(intfName);
interfacesBuilder.setSegmentationIds(new ArrayList<>());
interfaces.add(interfacesBuilder.build());
}
deviceBuilder.setDeviceName(deviceName);
deviceBuilder.setUuid(new Uuid(uuid));
deviceBuilder.setInterfaces(interfaces);
devices.add(deviceBuilder.build());
l2gatewayBuilder.setDevices(devices);
return l2gatewayBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.DeviceBuilder in project netconf by opendaylight.
the class IetfZeroTouchCallHomeServerProvider method createOperationalDevice.
private Device createOperationalDevice(final Device cfgDevice, final Device1 devStatus) {
final DeviceBuilder deviceBuilder = new DeviceBuilder().addAugmentation(devStatus).setUniqueId(cfgDevice.getUniqueId());
if (cfgDevice.getTransport() instanceof Ssh) {
final String hostKey = ((Ssh) cfgDevice.getTransport()).getSshClientParams().getHostKey();
final SshClientParams params = new SshClientParamsBuilder().setHostKey(hostKey).build();
final Transport sshTransport = new SshBuilder().setSshClientParams(params).build();
deviceBuilder.setTransport(sshTransport);
} else if (cfgDevice.getTransport() instanceof Tls) {
deviceBuilder.setTransport(cfgDevice.getTransport());
} else if (cfgDevice.getSshHostKey() != null) {
deviceBuilder.setSshHostKey(cfgDevice.getSshHostKey());
}
return deviceBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.DeviceBuilder in project netconf by opendaylight.
the class CallhomeStatusReporter method newDevice.
private static Device newDevice(final String id, final PublicKey serverKey, final Device1.DeviceStatus status) {
// used only for netconf devices that are connected via SSH transport and global credentials
String sshEncodedKey = serverKey.toString();
try {
sshEncodedKey = AuthorizedKeysDecoder.encodePublicKey(serverKey);
} catch (IOException e) {
LOG.warn("Unable to encode public key to ssh format.", e);
}
final SshClientParams sshParams = new SshClientParamsBuilder().setHostKey(sshEncodedKey).build();
final Transport transport = new SshBuilder().setSshClientParams(sshParams).build();
return new DeviceBuilder().setUniqueId(id).withKey(new DeviceKey(id)).setTransport(transport).addAugmentation(new Device1Builder().setDeviceStatus(status).build()).build();
}
Aggregations