X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ric_robot_suite%2Frobot%2Fresources%2Fo1mediator%2Fo1mediator_interface.robot;fp=ric_robot_suite%2Frobot%2Fresources%2Fo1mediator%2Fo1mediator_interface.robot;h=f869d958b6773ebd6f982da92d2000ffc8615f2d;hb=cc685917b28444e6e9fc70f1a96b14e073d8cec7;hp=0000000000000000000000000000000000000000;hpb=b7b0c942ee2b18adb12c6d57b9db940f22f3e151;p=it%2Ftest.git
diff --git a/ric_robot_suite/robot/resources/o1mediator/o1mediator_interface.robot b/ric_robot_suite/robot/resources/o1mediator/o1mediator_interface.robot
new file mode 100644
index 0000000..f869d95
--- /dev/null
+++ b/ric_robot_suite/robot/resources/o1mediator/o1mediator_interface.robot
@@ -0,0 +1,89 @@
+# Copyright (c) 2019 AT&T Intellectual Property.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+Library XML use_lxml=True
+Library NcclientLibrary
+
+*** Variables ***
+${XAppNS} urn:o-ran:ric:xapp-desc:1.0
+${NetconfNS} urn:ietf:params:xml:ns:netconf:base:1.0
+${ricXML} =
+${configXML} ${ricXML}
+
+
+*** Keywords ***
+Establish O1 Session
+ [Arguments] ${user}
+ ... ${password}
+ ... ${session}
+ ... ${host}=service-ricplt-o1mediator-tcp-netconf.ricplt
+ ... ${port}=830
+ ... ${hostkey_verify}=${False}
+ ... ${key}=/dev/null
+ ${status} = Connect host=${host}
+ ... port=${port}
+ ... username=${user}
+ ... password=${password}
+ ... key_filename=${key}
+ ... look_for_keys=False
+ ... alias=${session}
+ [Return] ${status}
+
+Retrieve O1 State
+ [Arguments] ${session}
+ # this doesn't actually seem to result in filtered XML,
+ # but it matches what the O1 CLI does.
+ ${filter} = Parse XML ${ricXML}
+ ${config} = Get ${session} filter_criteria=${filter}
+ [Return] ${config}
+
+Retrieve O1 Running Configuration
+ [Arguments] ${session}
+ ${config} = Get Config ${session} running
+ [Return] ${config}
+
+Deploy An XApp Using O1
+ [Arguments] ${session} ${app} ${version}
+ ${xappCreateXML} = Generate XApp Deployment XML ${app} ${version} create
+ Edit Config ${session} running ${xappCreateXML}
+
+Remove An XApp Using O1
+ [Arguments] ${session} ${app} ${version}
+ ${xappDeleteXML} = Generate XApp Deployment XML ${app} ${version} delete
+ Edit Config ${session} running ${xappDeleteXML}
+
+Close O1 Session
+ [Arguments] ${session}
+ Close Session ${session}
+
+*** Keywords ***
+Generate XApp Deployment XML
+ [Arguments] ${name} ${version} ${operation}
+ ${XML} = Parse XML ${configXML}
+ Add Element ${XML}
+ ...
+ ... xpath=ric
+ Add Element ${XML}
+ ... xpath=ric/xapps
+ Add Element ${XML}
+ ... ${name}
+ ... xpath=ric/xapps/xapp
+ Add Element ${XML} xapp-${name}
+ ... xpath=ric/xapps/xapp
+ Add Element ${XML} ${version}
+ ... xpath=ric/xapps/xapp
+ Add Element ${XML} ${GLOBAL_XAPP_NAMESPACE}
+ ... xpath=ric/xapps/xapp
+ [Return] ${XML}
\ No newline at end of file