phatina/python-lmiwbem

SLP discovery support request in lmiwbem

deleisha opened this issue · 13 comments

Thanks for the great work, Peter.
We are currently using pywbem for one of our projects and we saw lmiwbem as a better option.

Few things which users would certainly appreciate is having some facility to do SLP discovery in lmiwbem.

Also, if we have some way to switch on/off features like CIMListener will be another value add.

Thanks for the great work, Peter.

Thank you, too.

We are currently using pywbem for one of our projects and we saw lmiwbem as a better option.

Few things which users would certainly appreciate is having some facility to do SLP discovery in lmiwbem.

Sure, I will have a look at this soon.

Also, if we have some way to switch on/off features like CIMListener will be another value add.

Do you mean, to configure lmiwbem not to compile CIMIndicationListener into lmiwbem_core.so?

Fixed in c211e28.

Example: ./configure --with-listener=no

Okay, LDFLAGS does not seem to work as configure script still fails
What we have been looking around might be something like
AC_LIB_LINKS()
and the use pattern might be
./configure --with-pegasus-libdir=/path/to/lib --with-pegasus-includedir=/path/to/headers

I am not sure about this one. Can't it be controlled by LDFLAGS?

Thank you for fixing. I believe we can get away using LDFLAGS and as I am
illeterate on autotools like autoreconf. Did not know where to
plugin. Let me educate myself a bit on this and try to get lmiwbem working
on ubuntu.

Thanks Peter

Hope this clarifies our intention.

Reply to this email directly or view it on GitHub
#2 (comment).

regards,
Peter Hatina

Reply to this email directly or view it on GitHub
#2 (comment).

Warm Regards
--Dev
OpenPegasus Developer

"I'm one of those people that think Thomas Edison and the light bulb
changed the world more than Karl Marx ever did," Steve Jobs

SLP support was introduced in 1f79003.

Example of usage:

import lmiwbem

def delim():
    print "-" * 80

def print_slp_result(result):
    """
    Prints a SLP result.

    :param lmiwbem.SLPResult result: SLP result to print
    """
    delim()
    print "Type:", result.srvtype
    print "Host:", result.host
    print "Port:", result.port
    delim()
    print ""

# Discover WBEM services.
services = lmiwbem.slp_discover("service:wbem")

# Do something with SLP results
for result in services:
    print_slp_result(result)

Thank you Peter for working on this.
On Jul 3, 2014 3:22 PM, "Peter Hatina" notifications@github.com wrote:

SLP support was introduced in 1f79003
1f79003.

Example of usage:

import lmiwbem
def delim():
print "-" * 80
def print_slp_result(result):
""" Prints a SLP result.
:param lmiwbem.SLPResult result: SLP result to print """
delim()
print "Type:", result.srvtype
print "Host:", result.host
print "Port:", result.port
delim()
print ""

Discover WBEM services.services = lmiwbem.slp_discover("service:wbem")

Do something with SLP resultsfor result in services:

print_slp_result(result)

Reply to this email directly or view it on GitHub
#2 (comment).

Does the implementation meet your needs?

Let me just test and update you in a day or two?
On Jul 3, 2014 3:49 PM, "Peter Hatina" notifications@github.com wrote:

Does the implementation meet your needs?

Reply to this email directly or view it on GitHub
#2 (comment).

OK then.

While trying to compile lmiwbem with slp support, Got the following compile error.
Fixing this lead to break in some other place with same error.

Should we consider to remove the unicastic support? Looking at code at slp.h(the SDK header), which does not have define SLP_RETRY_UNICAST.
Seem that this is an openslp extension. Rfc 2608 does not seem to mention any reference to

SLP_RETRY_UNICAST
either.

In file included from lmiwbem_connection.cpp:34:
lmiwbem_constants.h:88: error: âSLP_RETRY_UNICASTâ was not declared in this scope
make[2]: *** [lmiwbem_core_la-lmiwbem_connection.lo] Error 1
make[2]: Leaving directory `/home/zenoss/CodeSpace/lmiwbem-master/src'
make[1]: *** [all-recursive] Error 1

Does this work for you?

diff --git a/src/lmiwbem_constants.cpp b/src/lmiwbem_constants.cpp
index b641807..6710dd9 100644
--- a/src/lmiwbem_constants.cpp
+++ b/src/lmiwbem_constants.cpp
@@ -79,7 +79,7 @@ void CIMConstants::init_type()
     bp::scope().attr("SLP_ERR_INTERNAL_SYSTEM_ERROR") = SLP_ERR_INTERNAL_SYSTEM_ERROR;
     bp::scope().attr("SLP_ERR_HANDLE_IN_USE") = SLP_ERR_HANDLE_IN_USE;
     bp::scope().attr("SLP_ERR_TYPE_ERROR") = SLP_ERR_TYPE_ERROR;
-#  ifndef UNICAST_NOT_SUPPORTED
+#  if !defined(UNICAST_NOT_SUPPORTED) && defined(SLP_RETRY_UNICAST)
     bp::scope().attr("SLP_ERR_RETRY_UNICAST") = SLP_ERR_RETRY_UNICAST;
 #  endif // UNICAST_NOT_SUPPORTED
 #endif // HAVE_SLP
diff --git a/src/lmiwbem_constants.h b/src/lmiwbem_constants.h
index 847c633..b2d30d9 100644
--- a/src/lmiwbem_constants.h
+++ b/src/lmiwbem_constants.h
@@ -84,7 +84,7 @@ public:
     static const int SLP_ERR_INTERNAL_SYSTEM_ERROR        = SLP_INTERNAL_SYSTEM_ERROR;
     static const int SLP_ERR_HANDLE_IN_USE                = SLP_HANDLE_IN_USE;
     static const int SLP_ERR_TYPE_ERROR                   = SLP_TYPE_ERROR;
-#    ifndef UNICAST_NOT_SUPPORTED
+#    if !defined(UNICAST_NOT_SUPPORTED) && defined(SLP_RETRY_UNICAST)
     static const int SLP_ERR_RETRY_UNICAST                = SLP_RETRY_UNICAST;
 #    endif // UNICAST_NOT_SUPPORTED
 #  endif // HAVE_SLP
diff --git a/src/lmiwbem_util.cpp b/src/lmiwbem_util.cpp
index d796e1c..420b5fb 100644
--- a/src/lmiwbem_util.cpp
+++ b/src/lmiwbem_util.cpp
@@ -416,7 +416,7 @@ bool is_error(const bp::object &value)
     case CIMConstants::SLP_ERR_INTERNAL_SYSTEM_ERROR:
     case CIMConstants::SLP_ERR_HANDLE_IN_USE:
     case CIMConstants::SLP_ERR_TYPE_ERROR:
-#  ifndef UNICAST_NOT_SUPPORTED
+#  if !defined(UNICAST_NOT_SUPPORTED) && defined(SLP_RETRY_UNICAST)
     case CIMConstants::SLP_ERR_RETRY_UNICAST:
 #  endif // UNICAST_NOT_SUPPORTED
 #endif // HAVE_SLP

Yes, It does fixes, Thank you.

On Mon, Jul 7, 2014 at 11:57 AM, Peter Hatina notifications@github.com
wrote:

Does this work for you?

diff --git a/src/lmiwbem_constants.cpp b/src/lmiwbem_constants.cppindex b641807..6710dd9 100644--- a/src/lmiwbem_constants.cpp+++ b/src/lmiwbem_constants.cpp@@ -79,7 +79,7 @@ void CIMConstants::init_type()
bp::scope().attr("SLP_ERR_INTERNAL_SYSTEM_ERROR") = SLP_ERR_INTERNAL_SYSTEM_ERROR;
bp::scope().attr("SLP_ERR_HANDLE_IN_USE") = SLP_ERR_HANDLE_IN_USE;
bp::scope().attr("SLP_ERR_TYPE_ERROR") = SLP_ERR_TYPE_ERROR;-# ifndef UNICAST_NOT_SUPPORTED+# if !defined(UNICAST_NOT_SUPPORTED) && defined(SLP_RETRY_UNICAST)
bp::scope().attr("SLP_ERR_RETRY_UNICAST") = SLP_ERR_RETRY_UNICAST;

endif // UNICAST_NOT_SUPPORTED

#endif // HAVE_SLPdiff --git a/src/lmiwbem_constants.h b/src/lmiwbem_constants.hindex 847c633..b2d30d9 100644--- a/src/lmiwbem_constants.h+++ b/src/lmiwbem_constants.h@@ -84,7 +84,7 @@ public:
static const int SLP_ERR_INTERNAL_SYSTEM_ERROR = SLP_INTERNAL_SYSTEM_ERROR;
static const int SLP_ERR_HANDLE_IN_USE = SLP_HANDLE_IN_USE;
static const int SLP_ERR_TYPE_ERROR = SLP_TYPE_ERROR;-# ifndef UNICAST_NOT_SUPPORTED+# if !defined(UNICAST_NOT_SUPPORTED) && defined(SLP_RETRY_UNICAST)
static const int SLP_ERR_RETRY_UNICAST = SLP_RETRY_UNICAST;

endif // UNICAST_NOT_SUPPORTED

endif // HAVE_SLPdiff --git a/src/lmiwbem_util.cpp b/src/lmiwbem_util.cppindex d796e1c..420b5fb 100644--- a/src/lmiwbem_util.cpp+++ b/src/lmiwbem_util.cpp@@ -416,7 +416,7 @@ bool is_error(const bp::object &value)

 case CIMConstants::SLP_ERR_INTERNAL_SYSTEM_ERROR:
 case CIMConstants::SLP_ERR_HANDLE_IN_USE:
 case CIMConstants::SLP_ERR_TYPE_ERROR:-#  ifndef UNICAST_NOT_SUPPORTED+#  if !defined(UNICAST_NOT_SUPPORTED) && defined(SLP_RETRY_UNICAST)
 case CIMConstants::SLP_ERR_RETRY_UNICAST:

endif // UNICAST_NOT_SUPPORTED

#endif // HAVE_SLP

Reply to this email directly or view it on GitHub
#2 (comment).

Warm Regards
--Dev
OpenPegasus Developer

"I'm one of those people that think Thomas Edison and the light bulb
changed the world more than Karl Marx ever did," Steve Jobs

Fixed in 33be60f.

SLP attributes discovery was introduced in 11c166a.

Example of usage:

import lmiwbem

def delim():
    print "-" * 80

def print_attrs(attrs):
    """
    Prints a SLP attrs result.

    :param dict attrs: SLP attrs result
    """
    delim()
    for k, v in attrs.iteritems():
        print "%s: %s" % (k, v)
    delim()

# Discover attributes.
attrs = lmiwbem.slp_discover_attrs("service:test.openslp://192.168.100.1:12345")

# Do something with the attributes.
print_attrs(attrs)