2 * Copyright (c) 2016 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package io.fd.vpp.jvpp.core.examples;
19 import java.io.PrintStream;
20 import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlags;
21 import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsNotification;
22 import io.fd.vpp.jvpp.core.dto.WantInterfaceEvents;
24 final class NotificationUtils {
26 private NotificationUtils() {}
28 static PrintStream printNotification(final SwInterfaceSetFlagsNotification msg) {
29 return System.out.printf("Received interface notification: ifc: %s%n", msg);
32 static SwInterfaceSetFlags getChangeInterfaceState() {
33 final SwInterfaceSetFlags swInterfaceSetFlags = new SwInterfaceSetFlags();
34 swInterfaceSetFlags.swIfIndex = 0;
35 swInterfaceSetFlags.adminUpDown = 1;
36 swInterfaceSetFlags.deleted = 0;
37 return swInterfaceSetFlags;
40 static WantInterfaceEvents getEnableInterfaceNotificationsReq() {
41 WantInterfaceEvents wantInterfaceEvents = new WantInterfaceEvents();
42 wantInterfaceEvents.pid = 1;
43 wantInterfaceEvents.enableDisable = 1;
44 return wantInterfaceEvents;
47 static WantInterfaceEvents getDisableInterfaceNotificationsReq() {
48 WantInterfaceEvents wantInterfaceEvents = new WantInterfaceEvents();
49 wantInterfaceEvents.pid = 1;
50 wantInterfaceEvents.enableDisable = 0;
51 return wantInterfaceEvents;