How do you make a looping connection in Omnetpp - connection

I have three people in the simulation, bob, bobby and boba. I can make them cyclic like
bob-bobby-boba-bob-bobby->>>> but i don't knnow how to make one that bounce., bob-bobby-boba-bobby-bob.
I tried
connections:
a.outG --> b.inG;
b.outG --> c.inG;
c.outG --> b.inG;
b.outG --> a.inG;
but it says that the connection is already blocked??

Define every gate as a vector gate, i.e.
gates:
input inG[];
output outG[];
Then in your connections use "++" to mark that next gate of vector is created:
connections:
a.outG++ --> b.inG++;
b.outG++ --> c.inG++;
c.outG++ --> b.inG++;
b.outG++ --> a.inG++;

Related

Launch node if not already running

When doing roslaunch <pkg> <file>.launch I want all nodes that are launched inside that file to only start if they're not running yet.
How do I do this?
If it's not possible, is it at least possible to do this for each node separately?
If someone has an idea it would be great if you added that code to my example .launch snippet below.
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<node pkg="rviz" type="rviz" name="rviz" />
</launch>
Unfortunately, this is not possible as discussed here.
roslaunch and rosrun will always run the node with the desired name which results in the fact, that the roscore will kill living nodes with the same name.
You can use the anon tag to run multiple instances with always varying names as explained here.
The only exception to this behavior is the roscore.xml and its nodes as explained here.
The only current workaround, from my point of view, is writing a script which checks via rosnode list if the desired node is already running and depending on the outcome, run your node or not.
Using <arg> tag in launch files that are connected through <include> tag, you can set up variables in top launch file and send to other included launch files. Then, using <if> and <unless>, you can start a node or leave it. You can find it's documentation in ROS_Wiki.
In multiple independent launch files, things are a little different since you don't have link between launch files. You can use environment variables to replicate the results .
you can check with the if tag and an eval statement:
if="$(eval not [s for s in eval('_' + '_import_' + '_(\'rosnode\')').get_node_names() if 'NODE_NAME' in s])"
i.e.:
<launch>
<node pkg="rviz" type="rviz" name="rviz"
if="$(eval not [s for s in eval('_' + '_import_' + '_(\'rosnode\')').get_node_names() if 'rviz' in s])"/>
</launch>

Error starting Hazelcast in kubernetes

I am trying to start Hazelcast in a Kubernetes/Docker cluster.
After some digging on the web, I found that someone has already thought about this.
Currently I am trying to use kubernetes-hazelcast lib
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-kubernetes</artifactId>
<version>1.0.0</version>
</dependency>
Here is my hazelcast config:
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.9.xsd"
xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group>
<name>GROUP_NAME</name>
<password>GROUP_NAME_PASSWORD</password>
</group>
<network>
<port auto-increment="true">5701</port>
<join>
<multicast enabled="false">
<multicast-group>224.2.2.3</multicast-group>
<multicast-port>54327</multicast-port>
</multicast>
<!-- <tcp-ip enabled="false">
<interface>127.0.0.1</interface>
</tcp-ip>-->
<!-- activate the Kubernetes plugin -->
<discovery-strategies>
<discovery-strategy enabled="true" class="com.hazelcast.kubernetes.HazelcastKubernetesDiscoveryStrategy">
<properties>
<!-- configure discovery service API lookup -->
<property name="service-name">service-name</property>
<property name="service-label-name">label-name</property>
<property name="service-label-value">true</property>
<property name="namespace">default</property>
</properties>
</discovery-strategy>
</discovery-strategies>
</join>
<interfaces enabled="false">
<interface>10.10.1.*</interface>
</interfaces>
<!-- <symmetric-encryption enabled="true">
encryption algorithm such as
DES/ECB/PKCS5Padding,
PBEWithMD5AndDES,
AES/CBC/PKCS5Padding,
Blowfish,
DESede
<algorithm>PBEWithMD5AndDES</algorithm>
salt value to use when generating the secret key
<salt>4oItUqH</salt>
pass phrase to use when generating the secret key
<password>gctuSBc5bKZrSwXk+</password>
iteration count to use when generating the secret key
<iteration-count>19</iteration-count>
</symmetric-encryption> -->
</network>
<executor-service>
<pool-size>16</pool-size>
<!-- <max-pool-size>64</max-pool-size>-->
<queue-capacity>64</queue-capacity>
<statistics-enabled>true</statistics-enabled>
<!-- <keep-alive-seconds>60</keep-alive-seconds>-->
</executor-service>
<queue name="default">
<!--
Maximum size of the queue. When a JVM's local queue size reaches the maximum,
all put/offer operations will get blocked until the queue size
of the JVM goes down below the maximum.
Any integer between 0 and Integer.MAX_VALUE. 0 means
Integer.MAX_VALUE. Default is 0.
-->
<max-size>0</max-size>
<!--
Maximum number of seconds for each item to stay in the queue. Items that are
not consumed in <time-to-live-seconds> will automatically
get evicted from the queue.
Any integer between 0 and Integer.MAX_VALUE. 0 means
infinite. Default is 0.
-->
<!-- <time-to-live-seconds>0</time-to-live-seconds>-->
</queue>
<map name="default">
<!--
Number of backups. If 1 is set as the backup-count for example,
then all entries of the map will be copied to another JVM for
fail-safety. Valid numbers are 0 (no backup), 1, 2, 3.
-->
<backup-count>4</backup-count>
<!--
Valid values are:
NONE (no eviction),
LRU (Least Recently Used),
LFU (Least Frequently Used).
NONE is the default.
-->
<eviction-policy>NONE</eviction-policy>
<!--
Maximum size of the map. When max size is reached,
map is evicted based on the policy defined.
Any integer between 0 and Integer.MAX_VALUE. 0 means
Integer.MAX_VALUE. Default is 0.
-->
<max-size>0</max-size>
<!--
When max. size is reached, specified percentage of
the map will be evicted. Any integer between 0 and 100.
If 25 is set for example, 25% of the entries will
get evicted.
-->
<eviction-percentage>25</eviction-percentage>
<!--
While recovering from split-brain (network partitioning),
map entries in the small cluster will merge into the bigger cluster
based on the policy set here. When an entry merge into the
cluster, there might an existing entry with the same key already.
Values of these entries might be different for that same key.
Which value should be set for the key? Conflict is resolved by
the policy set here. Default policy is hz.ADD_NEW_ENTRY
There are built-in merge policies such as
hz.NO_MERGE ; no entry will merge.
hz.ADD_NEW_ENTRY ; entry will be added if the merging entry's key
doesn't exist in the cluster.
hz.HIGHER_HITS ; entry with the higher hits wins.
hz.LATEST_UPDATE ; entry with the latest update wins.
-->
<merge-policy>hz.ADD_NEW_ENTRY</merge-policy>
</map>
<!-- Add your own map merge policy implementations here:
<merge-policies><map-merge-policy name="MY_MERGE_POLICY"><class-name>com.acme.MyOwnMergePolicy</class-name></map-merge-policy></merge-policies>
-->
</hazelcast>
After trying to start the program the hazelcast isn´t starting and it is raising an exception
2017-10-25 15:44:34,849 INFO [main] DiscoveryService:65 - [192.168.1.83]:5701 [dev] [3.9] Kubernetes Discovery: Bearer Token { null }
2017-10-25 15:44:34,888 ERROR [main] Launcher:97 - Unable to start EventEngineManager
java.lang.RuntimeException: Failed to configure discovery strategies
at com.hazelcast.spi.discovery.impl.DefaultDiscoveryService.loadDiscoveryStrategies(DefaultDiscoveryService.java:153)
at com.hazelcast.spi.discovery.impl.DefaultDiscoveryService.<init>(DefaultDiscoveryService.java:60)
at com.hazelcast.spi.discovery.impl.DefaultDiscoveryServiceProvider.newDiscoveryService(DefaultDiscoveryServiceProvider.java:29)
at com.hazelcast.instance.Node.createDiscoveryService(Node.java:265)
at com.hazelcast.instance.Node.<init>(Node.java:220)
at com.hazelcast.instance.HazelcastInstanceImpl.createNode(HazelcastInstanceImpl.java:160)
at com.hazelcast.instance.HazelcastInstanceImpl.<init>(HazelcastInstanceImpl.java:128)
at com.hazelcast.instance.HazelcastInstanceFactory.constructHazelcastInstance(HazelcastInstanceFactory.java:195)
at com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:174)
at com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:124)
at com.hazelcast.core.Hazelcast.newHazelcastInstance(Hazelcast.java:58)
at com.nsn.monitor.eva.eem.engine.state.EventEngineManagerContext.startup(EventEngineManagerContext.java:131)
at com.nsn.monitor.eva.eem.EventEngineManager.init(EventEngineManager.java:59)
at com.nsn.monitor.eva.eem.Launcher.initialize(Launcher.java:74)
at com.nsn.monitor.eva.eem.Launcher.main(Launcher.java:57)
Caused by: io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:53)
at io.fabric8.kubernetes.client.utils.HttpClientUtils.createHttpClient(HttpClientUtils.java:144)
at io.fabric8.kubernetes.client.BaseClient.<init>(BaseClient.java:41)
at io.fabric8.kubernetes.client.DefaultKubernetesClient.<init>(DefaultKubernetesClient.java:90)
at com.hazelcast.kubernetes.ServiceEndpointResolver.buildKubernetesClient(ServiceEndpointResolver.java:74)
at com.hazelcast.kubernetes.ServiceEndpointResolver.<init>(ServiceEndpointResolver.java:64)
at com.hazelcast.kubernetes.HazelcastKubernetesDiscoveryStrategy.<init>(HazelcastKubernetesDiscoveryStrategy.java:75)
at com.hazelcast.kubernetes.HazelcastKubernetesDiscoveryStrategyFactory.newDiscoveryStrategy(HazelcastKubernetesDiscoveryStrategyFactory.java:56)
at com.hazelcast.spi.discovery.impl.DefaultDiscoveryService.buildDiscoveryStrategy(DefaultDiscoveryService.java:185)
at com.hazelcast.spi.discovery.impl.DefaultDiscoveryService.loadDiscoveryStrategies(DefaultDiscoveryService.java:145)
... 14 more
Caused by: java.security.cert.CertificateParsingException: no more data allowed for version 1 certificate
at sun.security.x509.X509CertInfo.parse(X509CertInfo.java:672)
at sun.security.x509.X509CertInfo.<init>(X509CertInfo.java:167)
at sun.security.x509.X509CertImpl.parse(X509CertImpl.java:1804)
at sun.security.x509.X509CertImpl.<init>(X509CertImpl.java:195)
at sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:102)
at java.security.cert.CertificateFactory.generateCertificate(CertificateFactory.java:339)
at io.fabric8.kubernetes.client.internal.CertUtils.createTrustStore(CertUtils.java:68)
at io.fabric8.kubernetes.client.internal.CertUtils.createTrustStore(CertUtils.java:62)
at io.fabric8.kubernetes.client.internal.SSLUtils.trustManagers(SSLUtils.java:110)
at io.fabric8.kubernetes.client.internal.SSLUtils.trustManagers(SSLUtils.java:104)
at io.fabric8.kubernetes.client.utils.HttpClientUtils.createHttpClient(HttpClientUtils.java:68)
Since I don´t know where to point, could someone give me some guidance?
I don´t know if this a problem with the certificate in the docker, problem with my hazelcast config?
Since I am no expert on this, I am totally lost.
Basically it was a problem with certificate of the docker. Changed it and everything worked as it should

How to set a timeout in VoiceXML?

In VoiceXML, how can I set the timeout when start the xml?
This is my VoiceXML document:
<vxml version="2.1">
<form>
<block>
<prompt>Hello from VXML</prompt>
</block>
<transfer name="result" dest="tel:+12321312" bridge="true">
<prompt>Please wait while we transfer you.</prompt>
<grammar xml:lang="en-US" root = "TOPLEVEL" mode="voice">
<rule id="TOPLEVEL" scope="public">
<one-of>
<item> disconnect </item>
</one-of>
</rule>
</grammar>
</transfer>
</form>
</vxml>
Two transfer property you can use:
connecttimeout The time to wait while trying to connect the call before returning the noanswer condition. The value is a Time Designation . Only applies if bridge is true. Default is platform specific.
maxtime The time that the call is allowed to last, or 0s if no limit is imposed. The value is a Time Designation . Only applies if bridge is true. Default is 0s.
I'm not completely sure what you mean. If you want to set up a timeout so that it throws an error if that vxml page you posted is not fetched within that time, you can set the fetchtimeout property before your first form.
If you go to the W3C, it says:
A VoiceXML interpreter context needs to fetch VoiceXML documents, and other resources, such as audio files, grammars, scripts, and objects. Each fetch of the content associated with a URI is governed by the following attributes:
fetchtimeout
The interval to wait for the content to be returned before throwing an error.badfetch event. The value is a Time Designation (see Section 6.5). If not specified, a value derived from the innermost fetchtimeout property is used.
fetchhint
Defines when the interpreter context should retrieve content from the server. prefetch indicates a file may be downloaded when the page is loaded, whereas safe indicates a file that should only be downloaded when actually needed. If not specified, a value derived from the innermost relevant fetchhint property is used.
maxage
maxscale

Duplicate channel before being intercepted by interceptor

I'm using flume to do something like this
Source --> interceptor --> Channel --> multiplexing --> HDFS Sink
|-----------> Null Sink
I would like to add a channel just after the source but I don't want event pass through the interceptor. I would like "raw" event. Like this:
Source --> interceptor (i) --> Channel --> multiplexing --> HDFS Sink
| |-----------> Null Sink
|-------> Channel (must no be intercepted by i) --> HDFS
How can I do it ?
Thanks
Since interceptors are configured per source, you will have to add a second source (configured with no interceptors at all and listening in a different Http port), and emit your data twice: one copy for the source with interceptors, and one copy to the other source.
Another possibility is to chain two agents. The first one containing a single source with no interceptors, and two sinks: one for persisting the data as it is in HDFS, and the other feeding the agent you already have. I mean:
src-->ch-->multip-->sink----------->src-->int-->ch-->multip-->hdfssink
|-->hdfssink |-->nullsink
(________agent1____________) (_____________agent2_____________)

Ant equivalent of nant.onsuccess / nant.onfailure

NAnt has two built-in properties, nant.onsuccess and nant.onfailure, for specifying tasks to run on success and failure respectively.
Is there an equivalent in Ant?
I don't think there's an ant equivalent but you could use trycatch (part of ant-contrib)
<trycatch>
<try>
<!-- Your code here -->
<!-- Success message -->
</try>
<catch>
<!-- Fail message -->
</catch>
</trycatch>
Hope this helps
Kev Jackson, gave a neat example of an exec-listener in
his presentation, =
http://people.apache.org/~kevj/ossummit/extending-ant.html,
the sources of the exec-listener are included
You're able to kick off specific tasks depending
on the build result after your build has finished.
<exec-listener onSuccess="true|false">
..
your stuff goes here
..
</exec-listener>
Although I've marked John McG as the answer (as it's what I've gone with), I've also discovered that it's also possible to build similar functionality using BuildListeners.

Resources