Schedule Daily Script in Ericsson ENM

Can anyone share some tutorials on how to schedule a daily script that will run ENM CLI commands(cmedit get, set, action…) in Ericsson OSS? Not amos commands. Purpose is to run parameter changes in the network on specific time intervals.

Thank you,
Rade

To run CLI commands use python ‘enmscripting’ library included in scripting VM. To schedule use linux ‘cron’ tool.

1 Like

How can I get enm scripting library

Hi, you can download it from ENM Help

1 Like

Thanks a lot for your support, I had another question, when using amoshell library in python , I always get the same error (amos or moshell program not found), did you get that error before. And do you have any recommendations to solve it, or if you have any recommendation for another library doing the same function, I’m just trying to connect a node on ENM using python.

Hi, I never saw this library, where did you get it? We are using amos, REST API or XML, depending on purpose.

Hi,you can find it below, i need to connect to RBS node by amos via python. To be able to integrate the whole site using python, so what is the best way to do that, any links or codes will be very useful.

Hi, thanks for sharing. For me it works fine. I’m using python3 and moshell installed in Windows WSL Ubuntu. For your error possible solution is to initialize Amos with bin_path parameter:

mo = amoshell.Amos(bin_path='/path/to/moshell/')

according to its docstring
“”"
args:
- parallel: max number of parallel sessions mobatch will use. default=10.
- bin_path: path, if moshell/mobatch binaries are installed in a
non-standard location.

“”"

2 Likes

Hi,

I am using same function in my code , but when i try to run set commands, i am getting an error as “Invalid Command Buffer Contents” but when i run it in putty, i am not getting that error, could you please tell me what could be the reason? or how to resolve it?

Hi, can you, please, be more specific what function do you use.

Hi,

I am doing automation in UiPath on SSH,

I am using functions “l python /home/shared/{username}/app_cli.py ‘cmedit set {node_id} EUtranCellFDD.(eUtranCellFDDId=={CELL_ID}) administrativeState=UNLOCKED --force’”

to unlock cell, the python script allows me to do set operations via ssh , in python i am using enmscripting function , but i am getting an error as “Invalid Command Buffer Contents”,

Error: @“<L00332_7A_1) administrativeState=UNLOCKED --force’
Invalid command buffer contents
^C”

so basically, when i pass this command to remote server, the command is executing one character at a time and it is failing to execute after some point/ there might be buffer present from the previous command which overriding the information that i am using for the command, is there any way i can resolve this?

Maybe it is some illegal symbols in command or transmission issue. For set of commands it is prefer to use batch execute command. More accurate answer you can get with debugging your code.

Hi,

Unfortunately, there is no batch execute command to sector unlock, and i can only use one activity from coding perspective which RunShellCommand, i am using the code repository which is mentioned in the following link

I wanted to do something in the command itself to stop the buffering

C# is very hard way to do this kind of stuff. I’m not C# expert, but Async is not what I would use in this approach. Can you execute your code synchronously?

This code was working fine until 2 weeks back, after that we are getting an error as “Invalid Command Buffer contents”
we are using a python script as
cat </home/shared/{username}/app_cli.py
#!/usr/bin/python
import sys
import enmscripting as enm
#DEMO

getwhat = sys.argv[1]
print("command: " + str(getwhat))

session = enm.open()
try:
terminal = session.terminal()
response = terminal.execute(getwhat)
for line in response.get_output():
print(line)
except Exception as e:
print(e)

enm.close(session)
EOF

ultimately the buffer is coming from this command, is there any way we can change this python script to clear the buffer before executing the command/

Hi, there is no way to clear buffer and, I believe, there is no buffer. This python code just sends your command to enm API CLI handler and then periodically requests for result. I suspect buffer comes in with ssh/bash.

in that case , is there any command we can add it in the command to resolve that/?