use of org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdShort in project onos by opennetworkinglab.
the class CfmMepListCommand method doExecute.
@Override
protected void doExecute() {
CfmMepService mepService = get(CfmMepService.class);
CfmMdService mdService = get(CfmMdService.class);
if (mdStr != null && !mdStr.isEmpty()) {
MdId mdId = parseMdName(mdStr);
print(printMdId(mdId));
if (maStr != null && !maStr.isEmpty()) {
MaIdShort maId = parseMaName(maStr);
print(printMaId(maId));
if (mepStr != null && !mepStr.isEmpty()) {
MepId mepId = MepId.valueOf(Short.parseShort(mepStr));
try {
MepEntry mep = mepService.getMep(mdId, maId, mepId);
if (mep != null) {
print(printMepEntry(mep));
}
} catch (CfmConfigException e) {
log.error("Error retrieving Mep details {}", new MepKeyId(mdId, maId, mepId), e);
}
// MD, MA and MEP given
} else {
// MD and MA given but no MEP given
try {
mepService.getAllMeps(mdId, maId).forEach(mep -> print(printMepEntry(mep)));
} catch (CfmConfigException e) {
log.error("Error retrieving Meps for {}/{}", mdId.mdName(), maId.maName(), e);
}
}
} else {
// MD given but no MA given
mdService.getAllMaintenanceAssociation(mdId).forEach(ma -> {
print(printMaId(ma.maId()));
try {
mepService.getAllMeps(mdId, ma.maId()).forEach(mep -> print(printMepEntry(mep)));
} catch (CfmConfigException e) {
log.error("Error retrieving Meps for {}/{}", mdId.mdName(), ma.maId().maName(), e);
}
});
}
} else {
mdService.getAllMaintenanceDomain().forEach(md -> {
print(printMdId(md.mdId()));
mdService.getAllMaintenanceAssociation(md.mdId()).forEach(ma -> {
print(printMaId(ma.maId()));
try {
mepService.getAllMeps(md.mdId(), ma.maId()).forEach(mep -> print(printMepEntry(mep)));
} catch (CfmConfigException e) {
log.error("Error retrieving Meps for {}/{}", md.mdId().mdName(), ma.maId().maName(), e);
}
});
});
}
}
Aggregations