use of org.omecproject.up4.impl.Up4AdminService in project up4 by omec-project.
the class UePoolDeleteCommand method doExecute.
@Override
protected void doExecute() throws Exception {
Up4AdminService app = get(Up4AdminService.class);
Ip4Prefix poolPrefix = Ip4Prefix.valueOf(this.poolPrefix);
print("Deleting UE IPv4 address pool prefix: %s", poolPrefix);
app.adminDelete(UpfInterface.createUePoolFrom(poolPrefix, sliceId));
}
use of org.omecproject.up4.impl.Up4AdminService in project up4 by omec-project.
the class ResetEntriesCommand method doExecute.
@Override
protected void doExecute() throws UpfProgrammableException {
Up4AdminService app = get(Up4AdminService.class);
print("Clearing all UP4 dataplane table entries.");
app.adminDeleteAll(UpfEntityType.SESSION_UPLINK);
app.adminDeleteAll(UpfEntityType.SESSION_DOWNLINK);
app.adminDeleteAll(UpfEntityType.TERMINATION_UPLINK);
app.adminDeleteAll(UpfEntityType.TERMINATION_DOWNLINK);
app.adminDeleteAll(UpfEntityType.TUNNEL_PEER);
app.adminReadAll(UpfEntityType.INTERFACE);
Collection<UpfInterface> configInterfaces = app.configInterfaces();
// Remove only the interfaces from UP4 config
for (UpfInterface upfInterface : configInterfaces) {
app.adminDelete(upfInterface);
}
app.resetAllSessionMeters();
app.resetAllApplicationMeters();
print("Reinstalling UP4 interfaces and DBUF GTP Tunnel from app configuration.");
app.installUpfEntities();
}
use of org.omecproject.up4.impl.Up4AdminService in project up4 by omec-project.
the class ClearFlowsCommand method doExecute.
@Override
protected void doExecute() throws UpfProgrammableException {
Up4Service app = get(Up4Service.class);
Up4AdminService adminApp = get(Up4AdminService.class);
print("Clearing all currently installed UE sessions.");
app.deleteAll(UpfEntityType.APPLICATION);
app.deleteAll(UpfEntityType.SESSION_DOWNLINK);
app.deleteAll(UpfEntityType.SESSION_UPLINK);
app.deleteAll(UpfEntityType.TERMINATION_DOWNLINK);
app.deleteAll(UpfEntityType.TERMINATION_UPLINK);
app.deleteAll(UpfEntityType.TUNNEL_PEER);
adminApp.resetAllSessionMeters();
adminApp.resetAllApplicationMeters();
}
use of org.omecproject.up4.impl.Up4AdminService in project up4 by omec-project.
the class ReadUpfEntitiesCommand method doExecute.
@Override
protected void doExecute() {
Up4AdminService up4Admin = get(Up4AdminService.class);
Up4Service up4Service = get(Up4Service.class);
boolean filterCounters = false;
try {
List<UpfEntityType> printedTypes = new ArrayList<>();
if (all) {
printedTypes.add(UpfEntityType.APPLICATION);
printedTypes.add(UpfEntityType.SESSION_UPLINK);
printedTypes.add(UpfEntityType.SESSION_DOWNLINK);
printedTypes.add(UpfEntityType.TERMINATION_UPLINK);
printedTypes.add(UpfEntityType.TERMINATION_DOWNLINK);
printedTypes.add(UpfEntityType.TUNNEL_PEER);
printedTypes.add(UpfEntityType.INTERFACE);
printedTypes.add(UpfEntityType.SESSION_METER);
printedTypes.add(UpfEntityType.APPLICATION_METER);
filterCounters = true;
} else if (ue) {
printedTypes.add(UpfEntityType.APPLICATION);
printedTypes.add(UpfEntityType.SESSION_UPLINK);
printedTypes.add(UpfEntityType.SESSION_DOWNLINK);
printedTypes.add(UpfEntityType.TERMINATION_UPLINK);
printedTypes.add(UpfEntityType.TERMINATION_DOWNLINK);
printedTypes.add(UpfEntityType.TUNNEL_PEER);
printedTypes.add(UpfEntityType.SESSION_METER);
printedTypes.add(UpfEntityType.APPLICATION_METER);
filterCounters = true;
} else {
if (application) {
printedTypes.add(UpfEntityType.APPLICATION);
}
if (sessions) {
printedTypes.add(UpfEntityType.SESSION_UPLINK);
printedTypes.add(UpfEntityType.SESSION_DOWNLINK);
}
if (termination) {
printedTypes.add(UpfEntityType.TERMINATION_UPLINK);
printedTypes.add(UpfEntityType.TERMINATION_DOWNLINK);
}
if (tunnels) {
printedTypes.add(UpfEntityType.TUNNEL_PEER);
}
if (counters) {
printedTypes.add(UpfEntityType.COUNTER);
filterCounters = false;
}
if (interfaces) {
printedTypes.add(UpfEntityType.INTERFACE);
}
if (appMeters) {
printedTypes.add(UpfEntityType.APPLICATION_METER);
}
if (sessMeters) {
printedTypes.add(UpfEntityType.SESSION_METER);
}
}
for (var type : printedTypes) {
if (type.equals(UpfEntityType.TERMINATION_UPLINK)) {
Collection<? extends UpfEntity> terminations = up4Admin.adminReadAll(type);
for (var t : terminations) {
UpfTerminationUplink term = (UpfTerminationUplink) t;
print(term.toString());
if (filterCounters) {
print(up4Service.readCounter(term.counterId()).toString());
}
}
} else if (type.equals(UpfEntityType.TERMINATION_DOWNLINK)) {
Collection<? extends UpfEntity> terminations = up4Admin.adminReadAll(type);
for (var t : terminations) {
UpfTerminationDownlink term = (UpfTerminationDownlink) t;
print(term.toString());
if (filterCounters) {
print(up4Service.readCounter(term.counterId()).toString());
}
}
} else {
up4Admin.adminReadAll(type).forEach(upfEntity -> print(upfEntity.toString()));
}
}
} catch (UpfProgrammableException e) {
print("Error while reading UPF entity: " + e.getMessage());
}
}
use of org.omecproject.up4.impl.Up4AdminService in project up4 by omec-project.
the class GtpTunnelPeerCommand method doExecute.
@Override
protected void doExecute() throws Exception {
Up4AdminService app = get(Up4AdminService.class);
UpfGtpTunnelPeer.Builder tunnelPeerBuilder = UpfGtpTunnelPeer.builder().withTunnelPeerId(tunnelPeer).withSrcAddr(Ip4Address.valueOf(srcAddr)).withDstAddr(Ip4Address.valueOf(dstAddr));
if (srcPort != -1) {
tunnelPeerBuilder.withSrcPort(srcPort);
}
if (delete) {
app.adminDelete(tunnelPeerBuilder.build());
} else {
app.adminApply(tunnelPeerBuilder.build());
}
}
Aggregations