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 org.openvpp.jvpp.core.test;
19 import java.io.PrintStream;
20 import org.openvpp.jvpp.core.dto.SwInterfaceSetFlags;
21 import org.openvpp.jvpp.core.dto.SwInterfaceSetFlagsNotification;
22 import org.openvpp.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: %d, admin: %d, link: %d, deleted: %d\n",
30 msg.swIfIndex, msg.adminUpDown, msg.linkUpDown, msg.deleted);
33 static SwInterfaceSetFlags getChangeInterfaceState() {
34 final SwInterfaceSetFlags swInterfaceSetFlags = new SwInterfaceSetFlags();
35 swInterfaceSetFlags.swIfIndex = 0;
36 swInterfaceSetFlags.adminUpDown = 1;
37 swInterfaceSetFlags.deleted = 0;
38 return swInterfaceSetFlags;
41 static WantInterfaceEvents getEnableInterfaceNotificationsReq() {
42 WantInterfaceEvents wantInterfaceEvents = new WantInterfaceEvents();
43 wantInterfaceEvents.pid = 1;
44 wantInterfaceEvents.enableDisable = 1;
45 return wantInterfaceEvents;
48 static WantInterfaceEvents getDisableInterfaceNotificationsReq() {
49 WantInterfaceEvents wantInterfaceEvents = new WantInterfaceEvents();
50 wantInterfaceEvents.pid = 1;
51 wantInterfaceEvents.enableDisable = 0;
52 return wantInterfaceEvents;