Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
7 replies Latest Post - ‏2014-05-02T02:03:32Z by jgstew
Darknight
Darknight
72 Posts
ACCEPTED ANSWER

Pinned topic ip address properties

‏2014-04-14T12:31:33Z |

Hi ,

I am trying to get below ip address property via relevance,please guide me how these can be generated:

1. list of all ipv4 and ipv6 address in a single property usign relevance.(ipv4 and ipv6 separate proparties are available)

2.list of ipv4 and ipv6 address of system alongwith their version for eg :

whenever i try to run below relevance output is coming as :

q: (address of ip interfaces of network as string) whose (it as string does not contain "127.0.0.1")& "-" & (ip version of addresses of ip interfaces of network asstring)

A:10.18.154.166-ipv4

but as soon as i make it plural :

q: (addresses of ip interfaces of network as string) whose (it as string does not contain "127.0.0.1")& "-" & (ip versions of addresses of ip interfaces of network asstring)

E:A singular expression is required.

Please advice where i am doing mystake.

 

 

 

Updated on 2014-04-14T15:16:54Z at 2014-04-14T15:16:54Z by Darknight
  • jgstew
    jgstew
    410 Posts
    ACCEPTED ANSWER

    Re: ip address properties

    ‏2014-04-14T16:07:01Z  in response to Darknight

     

    (it as string &"-"& (ip version of it as string)) of addresses whose(it as string does not equal "127.0.0.1") of ip interfaces of network

     

    There are many ways to do the same thing in relevance, but some methods only work for singulars and not plurals.

     

    Updated on 2014-04-14T16:07:59Z at 2014-04-14T16:07:59Z by jgstew
    • Darknight
      Darknight
      72 Posts
      ACCEPTED ANSWER

      Re: ip address properties

      ‏2014-04-16T16:37:46Z  in response to jgstew

      thanks a lot jgstew for providing your valuable guidance.

      It would be of great help if you can let me know how to list down all thats is ipv4 as well as ipv6 addresses of any computer system via releavnce.

      i am aware there are two different relevance as mentioned below :

      for ipv4 :

      if ( exists true whose (if true then ( exists ip interfaces of network) else false) ) then addresses whose (it as string != "0.0.0.0") of ip interfaces whose (not loopback of it) of network as string else nothing

       

      for ipv6:

      if (exists property "ipv6 interfaces" and exists network) then addresses of ipv6 interfaces of adapters whose (up of it and not loopback of it) of network as string else ""

      But i am not able to combine both these properties to have desire result.Please suggest

      Thanks again for your valuable inputs.

      • jgstew
        jgstew
        410 Posts
        ACCEPTED ANSWER

        Re: ip address properties

        ‏2014-04-16T16:58:55Z  in response to Darknight

         

        (address of it as string & "-ipv4"; ipv6 address of it as string & "-ipv6") of adapters whose(up of it AND not loopback of it AND address of it as string != "127.0.0.1") of network

         

        • Darknight
          Darknight
          72 Posts
          ACCEPTED ANSWER

          Re: ip address properties

          ‏2014-04-18T07:41:06Z  in response to jgstew

          thanks a billion jgstew..for your help:)

          I have one more query regarding the relevance...if i try to list all the possible ips assigned to particular computer then it throws below error:

          q:(addresses of it as string & "-ipv4"; ipv6 addresses of it as string & "-ipv6") of adapters whose(up of it AND not loopback of it AND address of it as string != "127.0.0.1") ofnetwork

          E:A singular expression is required.

           

          Maube i am goofing up with relevance this time,could you please point out it. thanks again :)

           

          also if i try to run this relevance on redhat machine it gives me below error:

          Q: (address of it as string & "-ipv4"; ipv6 address of it as string & "-ipv6") of adapters whose(up of it AND not loopback of it AND address of it as string != "127.0.0.1") of network
          E: The operator "ipv6 address" is not defined.

          Updated on 2014-04-18T09:57:15Z at 2014-04-18T09:57:15Z by Darknight
          • jgstew
            jgstew
            410 Posts
            ACCEPTED ANSWER

            Re: ip address properties

            ‏2014-04-22T13:17:33Z  in response to Darknight

             

            The relevance already does list out all IPs of all NICs.

             

            Try this on redhat / others:

            ((address of it as string & "-ipv4") | ""; (ipv6 address of it as string & "-ipv6") | "") of adapters whose(up of it AND not loopback of it AND address of it as string != "127.0.0.1") of network

             

            The reason it may not have appeared to work to list all IPs of all NICs for you, is it may only return a result if there is BOTH an ipv4 address and an IPv6 address.

             

            • Darknight
              Darknight
              72 Posts
              ACCEPTED ANSWER

              Re: ip address properties

              ‏2014-04-28T10:32:37Z  in response to jgstew

              Thanks jgstew :)

              Since i have not defined the operator the above relevance was giving error - "The operator "ipv6 address" is not defined."

              I have tried it on RedHat and other operating systems it throwed me the same error , i have modified the above relevance a bit and come up with below solution which is perfectly working in nonwindows as well as on windows machine

               

              Q: ((address of it as string & "-ipv4") | ""; ((if (exists property "ipv6 interfaces" and exists network) then address of ipv6 interfaces of it as string else "") & "-ipv6") | "")of adapters whose(up of it AND not loopback of it AND address of it as string != "127.0.0.1") of network
              A: 172.16.1.139-ipv4
              A: fe80:0:0:0:250:56ff:feab:1d7e-ipv6
              A: 10.18.154.171-ipv4
              A: fe80:0:0:0:250:56ff:feab:3872-ipv6

               

              thanks a lot for providing a hint due to which now i am able to retrive the required property

              • jgstew
                jgstew
                410 Posts
                ACCEPTED ANSWER

                Re: ip address properties

                ‏2014-05-02T02:03:32Z  in response to Darknight

                Glad it worked out. I often forget about checking for the existence of a property, but it is a great way to handle a situation like this.