aboutsummaryrefslogtreecommitdiffstats
path: root/vpp-api/java/jvpp/org/openvpp/jvpp/test/NotificationUtils.java
blob: 9c24d572cbca039283ec67c82ed818643eb00511 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package org.openvpp.jvpp.test;

import java.io.PrintStream;
import org.openvpp.jvpp.dto.SwInterfaceSetFlags;
import org.openvpp.jvpp.dto.SwInterfaceSetFlagsNotification;
import org.openvpp.jvpp.dto.WantInterfaceEvents;

final class NotificationUtils {

    private NotificationUtils() {}

    static PrintStream printNotification(final SwInterfaceSetFlagsNotification msg) {
        return System.out.printf("Received interface notification: ifc: %d, admin: %d, link: %d, deleted: %d\n",
            msg.swIfIndex, msg.adminUpDown, msg.linkUpDown, msg.deleted);
    }

    static SwInterfaceSetFlags getChangeInterfaceState() {
        final SwInterfaceSetFlags swInterfaceSetFlags = new SwInterfaceSetFlags();
        swInterfaceSetFlags.swIfIndex = 0;
        swInterfaceSetFlags.adminUpDown = 1;
        swInterfaceSetFlags.deleted = 0;
        return swInterfaceSetFlags;
    }

    static WantInterfaceEvents getEnableInterfaceNotificationsReq() {
        WantInterfaceEvents wantInterfaceEvents = new WantInterfaceEvents();
        wantInterfaceEvents.pid = 1;
        wantInterfaceEvents.enableDisable = 1;
        return wantInterfaceEvents;
    }

    static WantInterfaceEvents getDisableInterfaceNotificationsReq() {
        WantInterfaceEvents wantInterfaceEvents = new WantInterfaceEvents();
        wantInterfaceEvents.pid = 1;
        wantInterfaceEvents.enableDisable = 0;
        return wantInterfaceEvents;
    }
}