Indeni Knowledge Language Training 

Module 4b: Command Runner


Indeni Knowledge Language Training Modules

Module 1: Introduction

Module 2: Interrogation & Monitoring

Module 3a: Basic JSON XML Parsing

Module 3b: Advanced JSON XML Parsing

Module 4a: Setting Up IKL Environment

Module 4b: Command Runner

Module 4c: Using SoureTree

Module 4d: Pull Request


Full Video Transcript:

Hey guys. For this video, we’re going to be focusing on how to test CommandRunner, how to leverage it, and so it’ll help you understand whether or not your parser scripts are working properly, simulated in your environment before you push it out and contribute code. This way, it helps you identify if you are running into any errors or bugs with your code, or if you need to fix it, or if it’s good to go.


So, for this session, we’re going to focus on something I’m very familiar with now is with the f5 LTM. So, this script was actually provided by one of our knowledge experts around f5. The essence of the script is to determine if there is any sort of weak ciphers that are being utilized for client traffic. Now, as you can see, the parser itself can be very, very complicated. But, that’s not the point of today’s session. The point is to really determine if we can create and generate and determine if the script was working properly.


And, in order to run this script, we’re going to need to get an input file. How do you get that input file? It’s very simple. Obviously, you knew the command when you were writing the script to determine how you’re going to get the output. All we’re going to do is run that command on the device so that we can get the output itself. Right now, I am SSHed into the f5 device that we’re testing. I’m going to go ahead and parse it, and then get this input file. Now, it’s quite a big of an input file, and that’s okay. All we want to do is copy and paste everything in terms of the raw output that you find on this device based on the command. So, I believe it’s up to here. Press ‘copy’. Then, you go ahead and open a new file. Go ahead and add all of the values. And, make sure that when you… And, that’s going to be your input file, by the way. But, make sure that when you save the input file, save it as the underlying Indeni script name, and then change the file ending to ‘.input’.


So, if I can find it right now really quick, I believe it is going to be this one. ‘profile-client-ssl-recursive.ind’. Instead, you’re going to want to go ahead and provide it a ‘.input’ file. And, that’s how CommandRunner, which is really a simulation of the Indeni Knowledge platform… That’s how it’s going to recognize what’s the input file, what it’s going to read, in terms of the raw data output. Now, let’s go ahead and simulate it. You now have the ‘.ind’ script. You now have the raw data output saved as the input file. I’m going to go ahead and simulate it by running CommandRunner.


We’re going to indicate to it that it’s parse only. We’re going to give it the ‘.ind’ script that it should be running. And, in order to do that, make sure you’re going to be in the directory that the script is in. So, for me, it’s going to be under ‘/Users/charleskim/Desktop/testing/parsers/f5/ltm/tmsh-list-ltm-profile-client-ssl-recursive-ciphers.ind’. Okay. So, now I’ve provided the ‘.ind’ script. And, in order to invoke and determine where the source file is for the raw data output, you’re going to type in ‘-f ’, and then you provide it the data output. If you don’t want to type the entire directory of where the ‘.ind’ script is, the best way to do this is simply navigate quickly into the directory by doing ‘cd’. Now, all you have to do is go ahead and invoke it [inaudible, 00:04:36], and if you press ‘tab’, you can see all the scripts that are in here.


Now, as you can see, I already have an output file for that. Well, let’s go ahead and remove it so that we can determine whether or not we generate the accurate output file. So now, as you can see, there’s only the ‘.ind’ script and the input file. If you type in ‘-f’, you’ll determine that it’ll be running the ‘.ind’ script from this input file. Once you type it in, you can go ahead and press ‘Enter’, and now the CommandRunner is running its simulation. It’s going to leverage the libraries that we have in place for the Indeni Knowledge platform and determine if it can leverage its underlying libraries to generate in a metric. If it works, it should tell you command output found for metrics or the number of metrics that you’ve created in your ‘.ind’ script. And, it should be provided in an output file, which you’ll be able to quickly find out here in the Sublime Text.


Now, let’s say, for example, the ‘.ind’ script is wrong and you want to see if you get an error. Let’s go ahead and simulate that real quick. Let’s delete this file and go to the ‘.ind’ script, and let’s just throw a wrench in the machine and add some values that we shouldn’t be. Let’s say, for example, you wrote some code and it doesn’t look like it’ll run through the machine. We’ll go ahead an just simulate that real quick by saving this ‘.ind’ script, and let’s see how it goes. Let’s see what happened. You can press ‘Up’ to pull up your previous command. And, if all goes wrong, we should be immediately able to determine that the output failed, and that the parser failed.


So, as you can see here, you’ll notice that there was a failure to parse the available input file, and if you scroll all the way to the top, you’ll see where exactly the parser failed to run. So, if you go all the way here, it’s going to say, ‘Starting command runner’. It’s about to run. Parse only for this ‘.ind’ script with this input file. It’s reading the input file. It’s compiling the script. It’s trying to run the script, and then you’ll see that there was a parse error, and it’ll tell you where the command failed with the input.


So, that’s it for today guys. If you have any questions, please pose it on the forums. Thank you.