Calling atomic functions across different technologies(Linux & Windows)

    • lokeshkumar.tiwari
      Participant
      3 years, 1 month ago #3325

      We have a requirement where we want to call atomic function which is present in Linux entity from a windows entity(Both of these entities are present in different projects). Is there a way by which we can achieve this requirement.

    • 974192
      Moderator
      3 years, 1 month ago #3328
      Up
      0
      Down
      ::

      Yes that can be achieved by adding both Linux and Windows as a dependency in your project. When you try to write code in your current project, you will find functions of Windows and Linux that can be added. Use ctrl+space for autocomplete to view all of them.

    • lokeshkumar.tiwari
      Participant
      3 years, 1 month ago #3330
      Up
      0
      Down
      ::

      Adding Linux as an dependency , is it like adding the project which is having custom code for Linux inside Linux shadow entity. As i want to make a call to a custom built atomic function which is in Linux entity(in a separate project) from a Windows entity which is in different project.

    • 2 years, 11 months ago #3510
      Up
      0
      Down
      ::

      Hi Lokesh,
      We are having a similar requirement and we are yet to find a solution for this. Even if we are able to use a Linux atomic function in Windows’s custom function, I don’t know where to call this Custom function from in UI (Whether from an Windows server entity or from Linux server entity). Please help us with the solution if you have any.

      Thanks in advance

      • lokeshkumar.tiwari
        Participant
        2 years, 11 months ago #3514
        Up
        0
        Down
        ::

        Hi Nishanth,

        As you mentioned you are able to call the Linux Atomic function from a Custom function which is created under Windows so you should be executing your use case on a Windows node in cheetah UI as we generally call custom function from UI, but please make sure both windows as well as Linux server is blueprinted on which you are calling your linux atomic function.

        • 2 years, 11 months ago #3516
          Up
          0
          Down
          ::

          Thanks Lokesh for your Inputs.

          But for Custom function execution, it will take the current Windows server entity (the entity from which we gonna run) as the HostName for its execution. But, for Linux atomic function present inside a custom function, how can we instruct the function to run on a particular Linux Host?

          If you are aware of Butterfly version, we were having separate input parameters called HostName, DomainName (In studio code) for each and every Standard Operators by which we can instruct the function where to run on.
          I’m expecting similar kind of things here in Cheetah i.e, I have to mention the HostName to an Atomic function from Input parameter itself.

          • lokeshkumar.tiwari
            Participant
            2 years, 11 months ago #3517
            Up
            2
            Down
            ::

            Yes that is very much possible, here in cheetah you can access the global blueprint and call the function on any node which is blueprinted in cheetah UI, you can pass in a parameter(Linux hostname, do pass FQDN as we have FQDN in blueprint) where you want to trigger you Linux based atomic function and now you will be good to call the atomic function on the created node.

            Below is the sample code using which you can create a node present in global blueprint:

            def lHostName=”xyz”//FQDN of linux server, this can be passed as a parameter to custom function
            Map<String, Object> attrMap = new HashMap<>();
            attrMap.put(“HostName”, lHostName); // key attributes
            Set<String> nodeLabels = new HashSet<>();
            nodeLabels.add(“Linux”);
            nodeEntityInstance = ceb.get(nodeLabels, attrMap);
            myNode = ceb.get(nodeEntityInstance.getId(), nodeLabels);
            def output = myNode.linux_atomic_function();

            You can use above lines of code in custom function created in Windows project. Now you can call any linux atomic function on myNode and also you can call your windows atomic function on subject which will point to the windows node on which use case was triggered.

            • Navin Udayakumar
              Participant
              2 years, 11 months ago #3520
              Up
              0
              Down
              ::

              Thanks Lokesh for your inputs. Tried the same and it is working fine.

              Also is there any way to call a Remedy Adapter function(Incident or Workorder) in our custom groovy function which is available in cheetah UI.

              Please help us with the solution if you have any.

            • 2 years, 11 months ago #3521
              Up
              0
              Down
              ::

              Great Thanks Lokesh! The code which you provided is very much helpful!

    • Nagarajan
      Participant
      2 years, 2 months ago #3712
      Up
      0
      Down
      ::

      Hi

      You can execute any entity’s function by executing Graph query in groovy and call any functions on the entity by passing respective parameter

      String queryOSNode = “GraphQuery.node(‘OS:”+hosttype+”‘).properties(‘OS.HostName’,'”+hostname+”‘)”;

      hosttype is your Entity Type in Blueprint
      hostname is FQDN or caption or key attribute of the entity which we used to search in ignio Maps in Blueprint

      def OSnode = node.executeQuery(queryOSNode) // this statement gets the respective entity and store it in OSnode as a List

      for(Object OS: OSnode){
      def result = OS.<functionname>(<function input params separated by comma>)
      eg: def result = OS.GetHostName() //any function name of the respective target entity.
      break;
      }

Viewing 4 reply threads

You must be logged in to reply to this topic.