IMPL: A1 <-> XApp Message Flow Testing
[it/test.git] / ric_robot_suite / docker / ric-robot / eteshare / ric / v1 / xapps / DemoXapp1 / index.php
1 <?php
2 /*
3 ======================================================================
4         Copyright (c) 2019 Nokia
5         Copyright (c) 2018-2019 AT&T Intellectual Property.
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
10
11        http://www.apache.org/licenses/LICENSE-2.0
12
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
16    implied. See the License for the specific language governing
17    permissions andlimitations under the License.
18 ======================================================================
19 */
20 $method = $_SERVER['REQUEST_METHOD'];
21 $request = explode("/", substr(@$_SERVER['PATH_INFO'], 1));
22 header('Content-type: application/json');
23
24 switch ($method) {
25   case 'GET':
26     do_something_with_get($request);  
27     break;
28   default:
29     handle_error($request);  
30     break;
31 }
32
33 function do_something_with_get() {
34     $data = [ 'name' => 'DemoXapp1', 'status' => 'started', 'version' => '1.2.3', 
35                  'instances' => [ 'name' => 'DemoXapp1', 'id' => 101, 'status' => 'started' , 
36                  'ip' => '192.168.0.1', 'port' => 23300 , 'txMessages' => [ 'ControlIndication' ], 
37                  'rxMessages' => [ 'LoadIndication' ] ] ];
38     echo json_encode( $data );
39 }
40
41 function handle_error() {
42    echo "Method not found";
43 }
44
45 ?>