how to obtain node ID in opnet? - numbers

how can I specify node ID in opnet by the use of op_topo_parent ??
I tried many times and the result was this error
<<< Recoverable Error >>>
Object ID (OPC_OBJID_INVALID) is out-of-range.
T (36.4974), EV (483), MOD (top.Office Network.user.wlan_port_rx_0_0), KP (op_topo_parent)
Can anyone give me a simplified example of how to use this function
thanks in advance.

op_topo_parent() needs a child object ID. Based on your error message, you want to find which node encompasses the given receiver(top.Office Network.user.wlan_port_rx_0_0). In order to get the node ID try the following code snippet.
// Get object of current Receiver object
rx_objid = op_id_self();
// Get parent, in this case node, ID
node_objid = op_topo_parent(rx_objid)
I hope this comments help you out.

Related

AttributeError: 'TeleBot' object has no attribute 'chat'

I want to create a variable,
message.chat.id outside of function
for example like this
bot = telebot.teleBot("token")
global message
message = bot.message.chat.id
#bot.message_handler(commands=["start"])
def welcome():
bot.send_message(message,"Welcome on here, pls describe yourself")
but the telebot attributes error
does the message argument always have to be inside the function, it can't be outside the function to become a variable?
I think this would be more appropriate code
bot = telebot.teleBot("token")
global message
message = message.chat.id
#bot.message_handler(commands=["start"])
def welcome(message):
global message
bot.send_message(message,"Welcome on here, pls describe yourself")
alternatively just use bot.reply_to(message,"Hello Bros")
you can find the full docs here

Gatling how to create a list and pass it to the session?

So I'd like to create a list of random numbers from -7 to 7 and then iterate through these numbers. So I am running the following in order to create the list and save it in the session:
.exec(session => {session.set("randomDays", Random.shuffle(-7 to 7 toList))})
But then when I try to iterate through the list with:
.foreach("randomDays", "counter")
I am getting getting the following error message:
" Condition evaluation crashed with message 'Can't cast value randomDays of type class java.lang.String into interface scala.collection.Seq'"
When I am looking at the session values I see what looks like a list of random values as expected (see attached screenshot). What am I getting wrong here?
If anyone is interested, what I ended up doing is creating a random days val in my test class and fetched a different day using a repeat counter.
.repeat(14, "counter") {
exec(session =>{session.set("randomDay",randomDays(session("counter").as[Int]))})
I would still be very happy to understand what I got wrong with my initial attempt :)

Get SOST database ID of sent emails

I have an ABAP program that sends emails. A sent email is stored in SOOD table. After sending an email I would like to get some ID of the email to be able to check its status later (in SOST table). I have seen more functions/methods to send email (e.g. cl_bcs/send, SO_NEW_DOCUMENT_SEND_API1), but none of them returns any ID. Is there a reliable way to get it?
Function module SO_NEW_DOCUMENT_SEND_API1 create and export a new OBJECT_ID for every new message sent, As you can see in here -
This NEW_OBJECT_ID stored at BCST_SR table in SCOM_KEY field. From BCST_SR table you've to get DOC_OID, using DOC_OID you can get details from SOOD table. (Reference field in SOOD is - IF_DOC_BCS ) Then use the Object number OBJNO to get the details from SOST table.
Also you can refer t-code SBWP to check your mail status.
For class CL_BCS, you can check the send_request object's method doc_wrapper_id. This will return the sood structer.
Two other answers gave me together valuable clues to get it done (+1). But both missed some accuracy and code snippets, so I sum it all up in my answer.
using cl_bcs
DATA gr_send_request TYPE REF TO cl_bcs.
DATA emailid LIKE soodk.
gr_send_request = cl_bcs=>create_persistent( ).
" ...
CALL METHOD gr_send_request->send(EXPORTING i_with_error_screen = 'X'
RECEIVING result = gv_sent_to_all ).
IF gv_sent_to_all = 'X'.
emailid = gr_send_request->send_request->doc_wrapper_id( ).
ENDIF.
SOODK (not sood) is structure containing three components (OBJTP, OBJYR, OBJNO) which are together the key in SOOD table.
using SO_NEW_DOCUMENT_SEND_API1
DATA LT_OBJECTID TYPE SOFOLENTI1-OBJECT_ID.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = LT_MAILSUBJECT
DOCUMENT_TYPE = 'HTM'
IMPORTING
new_object_id = lt_objectid
" ...
lt_objectid (SOFOLENTI1-OBJECT_ID) is char(17), that contains concatenated SOODK structure OBJTP+OBJYR+OBJNO. When divided to parts, it can be used to lookup a record in SOODK table. (I didn't find it in BCST_SR-SCOM_KEY, but it was not necessary.)

Anylogic is assigning the value to all entities instead of only one

My source has the following code in "On at exit" field:
TRUCK.ID_number = parameter;
parameter = parameter + 1;
Then, each truck will receive an ID: 1, 2, 3, ...
The problem is that All the trucks are circulating at the same time and it looks like everytime a new truck is generated and the code runs it resets the ID for all trucks.
For example: When truck 4 (ID = 4) is created at the source all the other trucks receive ID 4 so I cannot know the correct ID of each truck.
What am I doing wrong?
a few things. First, you need to use the keyword agent in the onExit code box. So in your case, agent.ID_number=parameter. Please read up on these specific keywords that pop up everywhere in AnyLogic code boxes. I call it the "magic lightbulb", also see my blog on that topic:
The magic lightbulb
Second, newly created agents automatically get a unique index (if they belong to the same population). You can access that using the getIndex() method inside your truck agent.
The answer is: Use entity.ID_number=parameter

Not able to get First Name, Last Name, or Realm Id from Open Id Attributes

According to the SSO documentation for IA these attributes should be available (I'm guessing a bit at the attributes URI):
First Name (http://axschema.org/namePerson/first)
Last Name (http://axschema.org/namePerson/last)
Realm Id (http://axschema.org/intuit/realmId)
Reviewing the query string passed during stage 3 of the open id request, here are the attributes present:
openid.alias3.type.alias1 => http://axschema.org/namePerson
openid.alias3.value.alias1 => Full Name
openid.alias3.type.alias2 => http://axschema.org/contact/email
openid.alias3.value.alias2 => email#test.com
Bug, error in the documentation, or loose nut behind the keyboard?
Two problems here, the first problem is in my haste of cut and paste coding I was only requesting the full name and email. I revised the code to request first name, last name, and realm id. Now first name and last name come through fine. However, it took a big of poking around to get to the bottom of the realm id issue. First, the documentation did not give a clear answer on the attribute uri; however, I was able to find a clear answer on this thread https://idnforums.intuit.com/textthread.aspx?catid=69&threadid=16954. Paul Jackson gives a clear idea what is going on here:
The attribute for realm id is http://axschema.org/intuit/realmId
Sometimes the attribute does not come through
I put together a technique based on his suggestion in this thread. Basically, if the realm id does not come through then I'll parse it from the referring url which has it in the query string as realmId. Clearly, this is brittle but provides a "working" solution for now.
Here is a code snippet you can use during stage 3 of the handshake.
_realmId = fetch.GetAttributeValue(OpenId.IntuitWellKnownRealmId);
if (_realmId == null && httpRequest.UrlReferrer != null)
{
var url = httpRequest.UrlReferrer.ToString();
var i = url.IndexOf('?');
if (i != -1)
{
var querystring = url.Substring(i);
_realmId = System.Web.HttpUtility.ParseQueryString(querystring)["realmId"];
}
}
I take zero credit for this solution, Paul already had it figured out. Just posting here to help anyone searching on this problem.