use of org.omecproject.up4.impl.Up4AdminService in project up4 by omec-project.
the class InterfaceInsertCommand method doExecute.
@Override
protected void doExecute() throws Exception {
Up4AdminService app = get(Up4AdminService.class);
Ip4Address n3Addr = Ip4Address.valueOf(this.n3Addr);
print("Adding N3 interface address: %s", n3Addr.toString());
app.adminApply(UpfInterface.createN3From(n3Addr, sliceId));
}
use of org.omecproject.up4.impl.Up4AdminService in project up4 by omec-project.
the class ReadFlowsCommand method doExecute.
@Override
protected void doExecute() throws Exception {
Up4AdminService adminService = get(Up4AdminService.class);
Collection<DownlinkUpfFlow> dlUpfFlow = adminService.getDownlinkFlows();
Collection<UplinkUpfFlow> ulUpfFlow = adminService.getUplinkFlows();
Collection<? extends UpfEntity> ulSess = adminService.adminReadAll(UpfEntityType.SESSION_UPLINK);
Collection<? extends UpfEntity> appFilters = adminService.adminReadAll(UpfEntityType.APPLICATION);
// Get session and app meter only to show the number of meters
Collection<? extends UpfEntity> sessMeters = adminService.adminReadAll(UpfEntityType.SESSION_METER);
Map<Integer, UpfMeter> sessMeterMap = sessMeters.stream().map(m -> (UpfMeter) m).collect(Collectors.toMap(UpfMeter::cellId, m -> m));
Collection<? extends UpfEntity> appMeters = adminService.adminReadAll(UpfEntityType.APPLICATION_METER);
print(SEPARATOR);
print(appFilters.size() + " Applications");
for (UpfEntity a : appFilters) {
if (!a.type().equals(UpfEntityType.APPLICATION)) {
print("ERROR: Wrong application filter: " + a);
continue;
}
UpfApplication app = (UpfApplication) a;
print("app_id=" + app.appId() + ", ipv4_prefix=" + app.ip4Prefix() + ", l4_range=" + app.l4PortRange() + ", ip_proto=" + app.ipProto());
}
print(SEPARATOR);
print(ulSess.size() + " Uplink Sessions");
for (UpfEntity s : ulSess) {
if (!s.type().equals(UpfEntityType.SESSION_UPLINK)) {
print("ERROR: Wrong uplink session: " + s);
continue;
}
UpfSessionUplink sess = (UpfSessionUplink) s;
print("n3_addr=" + sess.tunDstAddr() + ", teid=" + sess.teid() + (sess.needsDropping() ? ", drop()" : ", fwd(" + "sess_meter_idx=" + sess.sessionMeterIdx() + ")"));
UpfMeter sessMeter = sessMeterMap.getOrDefault(sess.sessionMeterIdx(), null);
if (sessMeter == null) {
print(" NO SESSION METER (sess_meter_idx=" + sess.sessionMeterIdx() + ")");
} else {
print(" Session meter: " + ppUpfMeter(sessMeter));
}
}
print(SEPARATOR);
print(ulUpfFlow.size() + " Uplink Flows");
for (UplinkUpfFlow f : ulUpfFlow) {
print(f.toString());
}
print(SEPARATOR);
print(dlUpfFlow.size() + " Downlink Flows");
for (DownlinkUpfFlow f : dlUpfFlow) {
print(f.toString());
}
print(SEPARATOR);
print("Apps=%d, UL sess=%d, UL flows=%d, DL flows=%s", appFilters.size(), ulSess.size(), ulUpfFlow.size(), dlUpfFlow.size());
print("App meters=%d, Sess meters=%d", appMeters.size(), sessMeters.size());
}
use of org.omecproject.up4.impl.Up4AdminService in project up4 by omec-project.
the class CounterReadCommand method doExecute.
@Override
protected void doExecute() throws Exception {
UpfCounter stats;
if (deviceId != null) {
Up4AdminService app = get(Up4AdminService.class);
stats = app.readCounter(ctrIndex, DeviceId.deviceId(deviceId));
} else {
Up4Service app = get(Up4Service.class);
stats = app.readCounter(ctrIndex);
}
print(stats.toString());
}
use of org.omecproject.up4.impl.Up4AdminService in project up4 by omec-project.
the class UePoolInsertCommand method doExecute.
@Override
protected void doExecute() throws Exception {
Up4AdminService app = get(Up4AdminService.class);
Ip4Prefix poolPrefix = Ip4Prefix.valueOf(this.poolPrefix);
print("Adding UE IPv4 address pool prefix: %s", poolPrefix.toString());
app.adminApply(UpfInterface.createUePoolFrom(poolPrefix, sliceId));
}
Aggregations