2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.template.demo;
23 import java.util.HashMap;
24 import java.util.UUID;
26 import org.junit.Test;
27 import org.onap.policy.appc.CommonHeader;
28 import org.onap.policy.appc.Request;
29 import org.onap.policy.appc.util.Serialization;
30 import org.onap.policy.vnf.trafficgenerator.PGRequest;
31 import org.onap.policy.vnf.trafficgenerator.PGStream;
32 import org.onap.policy.vnf.trafficgenerator.PGStreams;
33 import org.slf4j.Logger;
34 import org.slf4j.LoggerFactory;
36 public class TestAPPCPayload {
38 private static final Logger logger = LoggerFactory.getLogger(TestAPPCPayload.class);
41 PGRequest request = new PGRequest();
42 request.pgStreams = new PGStreams();
45 for(int i = 0; i < 5; i++){
46 pgStream = new PGStream();
47 pgStream.streamId = "fw_udp"+(i+1);
48 pgStream.isEnabled = "true";
49 request.pgStreams.pgStream.add(pgStream);
52 Request appc = new Request();
53 appc.CommonHeader = new CommonHeader();
54 appc.CommonHeader.RequestID = UUID.randomUUID();
55 appc.Action = "ModifyConfig";
56 appc.Payload = new HashMap<String, Object>();
57 appc.Payload.put("pg-streams", request);
58 logger.debug(Serialization.gsonPretty.toJson(appc));