Friday, August 24, 2012

Some Cisco AXL stuff in C# Snip 1.

Referring to Cisco Unified Configuration Manager.
First off, this stuff is damned hard to find out any documentation for the API's, very few examples around, developer forums pretty bare of any answers to a multitude of questions.

This was about the most helpful page that I found on the internet to start me off on the right footing.
http://ciscoaxlguy.wordpress.com/
Problem was for me, my client was on V7.1, so a few things were not working and needed investigation. So all of my snippets will be related to V7.1, Cisco seems to break a lot between releases.

To get Extension mobility objects in to the device profile I needed to query the database directly.

                     ExecuteSQLQueryReq _eSql_req = new ExecuteSQLQueryReq();
                     ExecuteSQLQueryRes _eSql_res;
                    _eSql_req.sql = "select name,pkid from telecasterservice";
                    _eSql_res = _proxy.executeSQLQuery(_eSql_req);

Don't believe the documentation that tells you that the underlying indicator to find an Unnassigned DN from the route plan report is the 'isCallable' flag. This flag relates to the UI interface 'Active' checkbox on the line details. Unfortunately this flag does not get updated if the associated device  is deleted and the line not, which is quite often the case.
The report must actually do the following sql query:-
select dnorpattern from numplan n inner join typepatternusage as tpu on n.tkpatternusage=tpu.enum left outer join devicenumplanmap as dmap on n.pkid = dmap.fknumplan where tpu.name='Device' and dmap.fknumplan is null and dnorpattern like...
So basically trying to find an unassociated device.






4 comments:

  1. Hi Kevin,
    Sounds like you've found you way to work with AXLAPIService class in C#? I am really stuck and is desperately looking for assistance. Would you have a minute to quickly check my below post?

    Many thanks
    Salim

    http://developer.cisco.com/web/axl-developer/forums/-/message_boards/message/17338631

    ReplyDelete
  2. Can you please post a snippet of how to loop through the SQL results?

    I have the following code:

    ExecuteSQLQueryReq sqlQueryReq = new ExecuteSQLQueryReq();
    String sqlQuery = "select eu.userid, emd.datetimestamp from extensionmobilitydynamic emd inner join enduser eu on emd.fkenduser_lastlogin=eu.pkid";

    sqlQueryReq.sql = sqlQuery;

    ExecuteSQLQueryRes sqlQueryRes = new ExecuteSQLQueryRes();

    sqlQueryRes = axl.executeSQLQuery(sqlQueryReq);

    which should return the usernames en when the last login/logout event occurred. However I've tried different methods to loop through the results but none work for me (as in, no results are shown).

    When executing the query on the CLI it works flawlessly.

    ReplyDelete
  3. Never mind, got it running, probably not the nicest way but it works :)

    getResponse = axl.executeSQLQuery(sqlQueryReq);

    //check how many rows are returned and loop through them.
    int numberOfRows = getResponse.@return.Count();
    for (int i = 0; i < numberOfRows; i++)
    {
    node = (XmlNode[])getResponse.@return.ElementAt< Object>(i);

    //Column 0 = userid, Column 3 = datetimestamp
    String userid = node[0].InnerXml.ToString();
    String firstName = node[1].InnerXml.ToString();
    String lastName = node[2].InnerXml.ToString();
    String epochTimeString = node[3].InnerXml.ToString();

    ReplyDelete
  4. Thanks for the info RKW, this is something im trying to do as well

    ReplyDelete