use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project netvirt by opendaylight.
the class EtreeGet method doExecute.
@Override
@Nullable
protected Object doExecute() {
LOG.debug("Executing Get EtreeInstance command for {}", etreeName);
if (etreeName != null) {
ElanInstance elanInstance = elanProvider.getElanInstance(etreeName);
if (elanInstance == null || elanInstance.augmentation(EtreeInstance.class) == null) {
session.getConsole().println("No Etree Instance present with name:" + etreeName);
} else {
session.getConsole().println(getEtreeHeaderOutput());
session.getConsole().println(String.format(ElanCLIUtils.ETREE_CLI_FORMAT, elanInstance.getElanInstanceName(), elanInstance.getMacTimeout(), elanInstance.getElanTag(), elanInstance.getDescription()));
}
} else {
List<ElanInstance> elanInstanceList = elanProvider.getElanInstances();
if (elanInstanceList != null && !elanInstanceList.isEmpty()) {
session.getConsole().println(getEtreeHeaderOutput());
for (ElanInstance elanInstance : elanInstanceList) {
if (elanInstance.augmentation(EtreeInstance.class) != null) {
session.getConsole().println(String.format(ElanCLIUtils.ETREE_INTERFACE_CLI_FORMAT, elanInstance.getElanInstanceName(), elanInstance.getMacTimeout(), elanInstance.getElanTag(), elanInstance.augmentation(EtreeInstance.class).getEtreeLeafTagVal().getValue(), elanInstance.getDescription()));
}
}
} else {
session.getConsole().println("No Etree Instances are present");
}
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project netvirt by opendaylight.
the class ElanInterfaceGet method doExecute.
@Override
@Nullable
protected Object doExecute() {
LOG.debug("Executing Get ElanInterface command for the corresponding Elan Instance for {}", elanName);
if (elanName != null) {
ElanInstance elanInstance = elanProvider.getElanInstance(elanName);
List<String> elanInterfaces = elanProvider.getElanInterfaces(elanName);
if (elanInterfaces == null) {
session.getConsole().println("No Elan Interfaces present for ELan Instance:" + elanName);
return null;
}
session.getConsole().println(getElanInterfaceHeaderOutput());
displayInterfaces(elanInstance, elanInterfaces);
} else {
List<ElanInstance> elanInstances = elanProvider.getElanInstances();
if (!elanInstances.isEmpty()) {
session.getConsole().println(getElanInterfaceHeaderOutput());
for (ElanInstance elanInstance : elanInstances) {
List<String> elanInterfaces = elanProvider.getElanInterfaces(elanInstance.getElanInstanceName());
displayInterfaces(elanInstance, elanInterfaces);
session.getConsole().println("\n");
}
}
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project netvirt by opendaylight.
the class EtreeInterfaceGet method doExecute.
@Override
@Nullable
protected Object doExecute() {
LOG.debug("Executing Get EtreeInterface command for the corresponding Etree Instance {}", etreeName);
if (etreeName != null) {
ElanInstance elanInstance = elanProvider.getElanInstance(etreeName);
if (elanInstance == null || elanInstance.augmentation(EtreeInstance.class) == null) {
session.getConsole().println("Etree instance doesn't exist or isn't configured as etree: " + etreeName);
return null;
}
List<String> elanInterfaces = elanProvider.getElanInterfaces(etreeName);
if (elanInterfaces == null) {
session.getConsole().println("No Etree Interfaces present for ELan Instance:" + etreeName);
return null;
}
session.getConsole().println(getEtreeInterfaceHeaderOutput());
displayInterfaces(elanInstance, elanInterfaces);
} else {
List<ElanInstance> elanInstances = elanProvider.getElanInstances();
if (!elanInstances.isEmpty()) {
session.getConsole().println(getEtreeInterfaceHeaderOutput());
for (ElanInstance elanInstance : elanInstances) {
List<String> elanInterfaces = elanProvider.getElanInterfaces(elanInstance.getElanInstanceName());
displayInterfaces(elanInstance, elanInterfaces);
session.getConsole().println("\n");
}
}
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project netvirt by opendaylight.
the class ElanMacTableGet method doExecute.
@Override
@Nullable
protected Object doExecute() {
LOG.debug("Executing elan mac table get command for {}", elanName);
Collection<MacEntry> macTables = elanProvider.getElanMacTable(elanName);
if (!macTables.isEmpty()) {
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yy:HH:mm:ss");
session.getConsole().println(getMacTableHeaderOutput());
session.getConsole().println(elanName);
for (MacEntry mac : macTables) {
boolean isStatic = mac.isIsStaticAddress();
session.getConsole().println(String.format(ElanCLIUtils.MAC_TABLE_CLI_FORMAT, "", mac.getInterface(), mac.getMacAddress().getValue(), ""));
session.getConsole().println(String.format(ElanCLIUtils.MAC_TABLE_CLI_FORMAT, "", isStatic, "", isStatic ? "-" : formatter.format(new Date(mac.getControllerLearnedForwardingEntryTimestamp().longValue()))));
}
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project netvirt by opendaylight.
the class ElanGet method doExecute.
@Override
@Nullable
protected Object doExecute() {
LOG.debug("Executing Get ElanInstance command for elanName: {}", elanName);
if (elanName != null) {
ElanInstance elanInstance = elanProvider.getElanInstance(elanName);
if (elanInstance == null) {
session.getConsole().println("No Elan Instance present with name:" + elanName);
} else {
session.getConsole().println(getElanHeaderOutput());
session.getConsole().println(String.format(ElanCLIUtils.ELAN_INTERFACE_CLI_FORMAT, elanInstance.getElanInstanceName(), elanInstance.getMacTimeout(), elanInstance.getElanTag(), elanInstance.getDescription()));
}
} else {
List<ElanInstance> elanInstanceList = elanProvider.getElanInstances();
if (elanInstanceList != null && !elanInstanceList.isEmpty()) {
session.getConsole().println(getElanHeaderOutput());
for (ElanInstance elanInstance : elanInstanceList) {
session.getConsole().println(String.format(ElanCLIUtils.ELAN_INTERFACE_CLI_FORMAT, elanInstance.getElanInstanceName(), elanInstance.getMacTimeout(), elanInstance.getElanTag(), elanInstance.getDescription()));
}
} else {
session.getConsole().println("No Elan Instances are present");
}
}
return null;
}
Aggregations