VPP-330 Track pending map-requests with a fifo
[vpp.git] / vpp-api / java / jvpp-core / org / openvpp / jvpp / core / test / NotificationUtils.java
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  *
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:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.openvpp.jvpp.core.test;
18
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;
23
24 final class NotificationUtils {
25
26     private NotificationUtils() {}
27
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);
31     }
32
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;
39     }
40
41     static WantInterfaceEvents getEnableInterfaceNotificationsReq() {
42         WantInterfaceEvents wantInterfaceEvents = new WantInterfaceEvents();
43         wantInterfaceEvents.pid = 1;
44         wantInterfaceEvents.enableDisable = 1;
45         return wantInterfaceEvents;
46     }
47
48     static WantInterfaceEvents getDisableInterfaceNotificationsReq() {
49         WantInterfaceEvents wantInterfaceEvents = new WantInterfaceEvents();
50         wantInterfaceEvents.pid = 1;
51         wantInterfaceEvents.enableDisable = 0;
52         return wantInterfaceEvents;
53     }
54 }