Search in sources :

Example 1 with Up4Service

use of org.omecproject.up4.Up4Service in project up4 by omec-project.

the class TerminationDownlinkCommand method doExecute.

@Override
protected void doExecute() throws Exception {
    Up4Service app = get(Up4Service.class);
    UpfTerminationDownlink.Builder termBuilder = UpfTerminationDownlink.builder().needsDropping(drop).withUeSessionId(Ip4Address.valueOf(ueAddr)).withApplicationId(appId).withCounterId(counterID);
    if (trafficClass != -1) {
        termBuilder.withTrafficClass(trafficClass);
    }
    if (teid != -1) {
        termBuilder.withTeid(teid);
    }
    if (qfi != -1) {
        termBuilder.withQfi(qfi);
    }
    if (appMeterIdx != -1) {
        termBuilder.withAppMeterIdx(appMeterIdx);
    }
    if (delete) {
        app.delete(termBuilder.build());
    } else {
        app.apply(termBuilder.build());
    }
}
Also used : Up4Service(org.omecproject.up4.Up4Service) UpfTerminationDownlink(org.onosproject.net.behaviour.upf.UpfTerminationDownlink)

Example 2 with Up4Service

use of org.omecproject.up4.Up4Service in project up4 by omec-project.

the class UpfSessionMeterCommand method doExecute.

@Override
protected void doExecute() throws Exception {
    Up4Service app = get(Up4Service.class);
    if (delete) {
        app.apply(UpfMeter.resetSession(cellId));
    } else {
        if (pir == null || pburst == null) {
            print("PIR and PBURST must be provided when creating a meter");
            return;
        }
        UpfMeter sessionMeter = UpfMeter.builder().setCellId(cellId).setPeakBand(pir, pburst).setSession().build();
        app.apply(sessionMeter);
    }
}
Also used : Up4Service(org.omecproject.up4.Up4Service) UpfMeter(org.onosproject.net.behaviour.upf.UpfMeter)

Example 3 with Up4Service

use of org.omecproject.up4.Up4Service in project up4 by omec-project.

the class SessionUplinkCommand method doExecute.

@Override
protected void doExecute() throws Exception {
    Up4Service app = get(Up4Service.class);
    UpfSessionUplink.Builder sessionBuilder = UpfSessionUplink.builder().needsDropping(drop).withTunDstAddr(Ip4Address.valueOf(n3Addr)).withTeid(teid);
    if (sessMeterIdx != -1) {
        sessionBuilder.withSessionMeterIdx(sessMeterIdx);
    }
    if (delete) {
        app.delete(sessionBuilder.build());
    } else {
        app.apply(sessionBuilder.build());
    }
}
Also used : Up4Service(org.omecproject.up4.Up4Service) UpfSessionUplink(org.onosproject.net.behaviour.upf.UpfSessionUplink)

Example 4 with Up4Service

use of org.omecproject.up4.Up4Service 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();
}
Also used : Up4Service(org.omecproject.up4.Up4Service) Up4AdminService(org.omecproject.up4.impl.Up4AdminService)

Example 5 with Up4Service

use of org.omecproject.up4.Up4Service in project up4 by omec-project.

the class ApplicationFilteringCommand method doExecute.

@Override
protected void doExecute() throws Exception {
    Up4Service app = get(Up4Service.class);
    UpfApplication.Builder appFilterBuilder = UpfApplication.builder().withAppId(appId).withPriority(priority).withSliceId(sliceId);
    boolean oneFilter = false;
    if (ipPrefix != null) {
        appFilterBuilder.withIp4Prefix(Ip4Prefix.valueOf(ipPrefix));
        oneFilter = true;
    }
    if (l4Port != null) {
        appFilterBuilder.withL4PortRange(Range.closed(l4Port, l4Port));
        oneFilter = true;
    }
    if (ipProto != null) {
        appFilterBuilder.withIpProto(ipProto);
        oneFilter = true;
    }
    if (!oneFilter) {
        print("At least one filter (IpPrefix, L4Port, IpProto) must be provided");
        return;
    }
    if (delete) {
        app.delete(appFilterBuilder.build());
    } else {
        app.apply(appFilterBuilder.build());
    }
}
Also used : Up4Service(org.omecproject.up4.Up4Service) UpfApplication(org.onosproject.net.behaviour.upf.UpfApplication)

Aggregations

Up4Service (org.omecproject.up4.Up4Service)12 Up4AdminService (org.omecproject.up4.impl.Up4AdminService)3 Ip4Address (org.onlab.packet.Ip4Address)2 UpfMeter (org.onosproject.net.behaviour.upf.UpfMeter)2 UpfProgrammableException (org.onosproject.net.behaviour.upf.UpfProgrammableException)2 UpfTerminationDownlink (org.onosproject.net.behaviour.upf.UpfTerminationDownlink)2 UpfTerminationUplink (org.onosproject.net.behaviour.upf.UpfTerminationUplink)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 List (java.util.List)1 Command (org.apache.karaf.shell.api.action.Command)1 Option (org.apache.karaf.shell.api.action.Option)1 Service (org.apache.karaf.shell.api.action.lifecycle.Service)1 Up4Translator (org.omecproject.up4.Up4Translator)1 Up4Store (org.omecproject.up4.impl.Up4Store)1 AbstractShellCommand (org.onosproject.cli.AbstractShellCommand)1 UpfApplication (org.onosproject.net.behaviour.upf.UpfApplication)1 UpfCounter (org.onosproject.net.behaviour.upf.UpfCounter)1 UpfEntity (org.onosproject.net.behaviour.upf.UpfEntity)1 UpfEntityType (org.onosproject.net.behaviour.upf.UpfEntityType)1