ea8c5496a548b8c22b0fdff46b7795578bb71b04
[transportpce.git] / nbinotifications / src / test / java / org / opendaylight / transportpce / nbinotifications / utils / NotificationServiceDataUtils.java
1 /*
2  * Copyright © 2020 Orange, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.transportpce.nbinotifications.utils;
9
10 import java.util.Map;
11 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev210528.NodeIdType;
12 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ConnectionType;
13 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.endpoint.RxDirection;
14 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.endpoint.RxDirectionBuilder;
15 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.endpoint.RxDirectionKey;
16 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.endpoint.TxDirection;
17 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.endpoint.TxDirectionBuilder;
18 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.endpoint.TxDirectionKey;
19 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.lgx.LgxBuilder;
20 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.port.PortBuilder;
21 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
22 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev191129.ServiceFormat;
23 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
24 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessServiceBuilder;
25 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService;
26 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmServiceBuilder;
27 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService;
28 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessServiceBuilder;
29 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
30 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder;
31 import org.opendaylight.yangtools.yang.common.Uint32;
32 import org.opendaylight.yangtools.yang.common.Uint8;
33
34 public final class NotificationServiceDataUtils {
35
36     private NotificationServiceDataUtils() {
37     }
38
39     public static NotificationProcessService buildSendEventInput() {
40         return new NotificationProcessServiceBuilder()
41                 .setMessage("message")
42                 .setServiceName("service1")
43                 .setOperationalState(State.InService)
44                 .setResponseFailed("")
45                 .setCommonId("commond-id")
46                 .setConnectionType(ConnectionType.Service)
47                 .setServiceZEnd(getServiceZEndBuild().build())
48                 .setServiceAEnd(getServiceAEndBuild().build())
49                 .build();
50     }
51
52     public static NotificationsProcessService buildReceivedEvent() {
53         return new NotificationsProcessServiceBuilder()
54                 .setMessage("message")
55                 .setServiceName("service1")
56                 .setOperationalState(State.InService)
57                 .setResponseFailed("")
58                 .setCommonId("commond-id")
59                 .setConnectionType(ConnectionType.Service)
60                 .setServiceZEnd(getServiceZEndBuild().build())
61                 .setServiceAEnd(getServiceAEndBuild().build())
62                 .build();
63     }
64
65     public static NotificationsAlarmService buildReceivedAlarmEvent() {
66         return new NotificationsAlarmServiceBuilder()
67                 .setMessage("message")
68                 .setServiceName("service1")
69                 .setOperationalState(State.InService)
70                 .setConnectionType(ConnectionType.Service)
71                 .build();
72     }
73
74     public static ServiceAEndBuilder getServiceAEndBuild() {
75         return new ServiceAEndBuilder()
76                 .setClli("clli")
77                 .setServiceFormat(ServiceFormat.OC)
78                 .setServiceRate(Uint32.valueOf(1))
79                 .setNodeId(new NodeIdType("XPONDER-1-2"))
80                 .setTxDirection(getTxDirection())
81                 .setRxDirection(getRxDirection());
82     }
83
84     public static ServiceZEndBuilder getServiceZEndBuild() {
85         return new ServiceZEndBuilder()
86                 .setClli("clli")
87                 .setServiceFormat(ServiceFormat.OC)
88                 .setServiceRate(Uint32.valueOf(1))
89                 .setNodeId(new NodeIdType("XPONDER-1-2"))
90                 .setTxDirection(getTxDirection())
91                 .setRxDirection(getRxDirection());
92     }
93
94     private static Map<TxDirectionKey, TxDirection> getTxDirection() {
95         return Map.of(new TxDirectionKey(Uint8.ZERO), new TxDirectionBuilder()
96                 .setPort(new PortBuilder()
97                         .setPortDeviceName("device name")
98                         .setPortName("port name")
99                         .setPortRack("port rack")
100                         .setPortShelf("port shelf")
101                         .setPortSlot("port slot")
102                         .setPortSubSlot("port subslot")
103                         .setPortType("port type")
104                         .build())
105                 .setLgx(new LgxBuilder()
106                         .setLgxDeviceName("lgx device name")
107                         .setLgxPortName("lgx port name")
108                         .setLgxPortRack("lgx port rack")
109                         .setLgxPortShelf("lgx port shelf")
110                         .build())
111                 .setIndex(Uint8.ZERO)
112                 .build());
113     }
114
115     private static Map<RxDirectionKey, RxDirection> getRxDirection() {
116         return Map.of(new RxDirectionKey(Uint8.ZERO), new RxDirectionBuilder()
117                 .setPort(new PortBuilder()
118                         .setPortDeviceName("device name")
119                         .setPortName("port name")
120                         .setPortRack("port rack")
121                         .setPortShelf("port shelf")
122                         .setPortSlot("port slot")
123                         .setPortSubSlot("port subslot")
124                         .setPortType("port type")
125                         .build())
126                 .setLgx(new LgxBuilder()
127                         .setLgxDeviceName("lgx device name")
128                         .setLgxPortName("lgx port name")
129                         .setLgxPortRack("lgx port rack")
130                         .setLgxPortShelf("lgx port shelf")
131                         .build())
132                 .setIndex(Uint8.ZERO)
133                 .build());
134     }
135 }