The following error appears during initializing my network:
<!> check_and_cast(): Cannot cast (inet::Ipv4FlatNetworkConfigurator*)GigabitNetwork.configurator to type 'inet::Ipv4NetworkConfigurator *' -- in module (inet::Ipv4NodeConfigurator) GigabitNetwork.standardHost[0].ipv4.configurator (id=421), during network initialization
I have been trying to solve it for a while, but without success.
Here is my network:
Network GigabitNetwork
{
parameters:
int numHosts;
#display("bgb=449,342");
types:
channel Ether1000m extends DatarateChannel
{
datarate = 1000Mbps;
delay = 0.1s;
}
submodules:
CentralSwitch: EtherSwitch {
#display("p=189,139");
}
Switch1: EtherSwitch {
#display("p=149,198");
}
Switch2: EtherSwitch {
#display("p=271,198");
}
Switch3: EtherSwitch {
#display("p=258,76");
}
Switch4: EtherSwitch {
#display("p=143,94");
}
standardHost[numHosts]: StandardHost {
#display("p=334,38");
}
standardHost1[numHosts]: StandardHost {
#display("p=342,205");
}
standardHost2[numHosts]: StandardHost {
#display("p=57,256");
}
standardHost3[numHosts]: StandardHost {
#display("p=42,38");
}
Server: StandardHost {
#display("p=42,146;i=device/server");
}
configurator: Ipv4FlatNetworkConfigurator {
#display("p=201,293");
}
connections:
CentralSwitch.ethg++ <--> Ether1000m <--> Server.ethg++;
CentralSwitch.ethg++ <--> Ether1000m <--> Switch4.ethg++;
CentralSwitch.ethg++ <--> Ether1000m <--> Switch3.ethg++;
CentralSwitch.ethg++ <--> Ether1000m <--> Switch2.ethg++;
CentralSwitch.ethg++ <--> Ether1000m <--> Switch1.ethg++;
for i=0..numHosts-1 {
standardHost1[i].ethg++ <--> Ether1000m <--> Switch2.ethg++;
standardHost2[i].ethg++ <--> Ether1000m <--> Switch1.ethg++;
standardHost[i].ethg++ <--> Ether1000m <--> Switch3.ethg++;
standardHost3[i].ethg++ <--> Ether1000m <--> Switch4.ethg++;
}
}
And my INI file:
[General]
network = GigabitNetwork
sim-time-limit = 120s
**.numHosts = 5
*.*.numApps = 1
**.channel.throughput.statistic-recording = true
**.channel.throughput.result-recording-modes = all
**.*.vector-recording = true
**.*.vector-recording-intervals= 0..3600
[Config Udp]
*.standardHost[*].app[0].typename = "UdpVideoStreamClient"
*.standardHost[*].app[0].serverAddress = "Server"
*.standardHost[*].app[0].serverPort = 1000
*.standardHost[*].app[0].startTime = uniform(0s, 0.1s)
*.standardHost1[*].app[0].typename = "UdpVideoStreamClient"
*.standardHost1[*].app[0].serverAddress = "Server"
*.standardHost1[*].app[0].serverPort = 1000
*.standardHost1[*].app[0].startTime = uniform(0s, 0.1s)
*.standardHost2[*].app[0].typename = "UdpVideoStreamClient"
*.standardHost2[*].app[0].serverAddress = "Server"
*.standardHost2[*].app[0].serverPort = 1000
*.standardHost2[*].app[0].startTime = uniform(0s, 0.1s)
*.standardHost3[*].app[0].typename = "UdpVideoStreamClient"
*.standardHost3[*].app[0].serverAddress = "Server"
*.standardHost3[*].app[0].serverPort = 1000
*.standardHost3[*].app[0].startTime = uniform(0s, 0.1s)
*.Server.app[0].typename = "UdpVideoStreamServer"
*.Server.app[0].localPort = 1000
*.Server.app[0].sendInterval = 0.001s
*.Server.app[0].packetLen =1400B
*.Server.app[0].videoSize = 1Gb
In your NED try to change the line
configurator: Ipv4FlatNetworkConfigurator {
into:
configurator: Ipv4NetworkConfigurator {
Related
I have the following WAF rule:
rule {
name = "rule4"
action {
block {}
}
priority = 40
statement {
rate_based_statement {
limit = 100
aggregate_key_type = "IP"
scope_down_statement {
byte_match_statement {
field_to_match {
uri_path {}
}
positional_constraint = "STARTS_WITH"
search_string = "/search"
text_transformation {
priority = 0
type = "NONE"
}
}
}
}
}
}
I also have a generic rule for limiting the rate:
rule {
name = "rule5"
action {
block {}
}
priority = 300
statement {
rate_based_statement {
limit = 3000
aggregate_key_type = "IP"
}
}
}
When a lot of requests are made to https://myexample.com/search?someQueryParams=here, they are picked up by rule5, not rule4, and I'm not sure why. Any idea?
UPDATE BELOW!!
I'm trying to let the user decide which of the 3 routes provided, they want to take. Here is the screenshot of the routes.
I am using the HERE SDK FOR ANDROID (PREMIUM EDITION) 3.18.5
Here is my code for adding the routes to the map:
coreRouter.calculateRoute(routePlan,
object : Router.Listener<List<RouteResult>, RoutingError> {
override fun onProgress(i: Int) {
}
override fun onCalculateRouteFinished(
routeResults: List<RouteResult>,
routingError: RoutingError
) {
if (routingError === RoutingError.NONE) {
routeResultsList = routeResults
if (routeResults[0].route != null) {
route = routeResults[0].route
mapRoute = MapRoute(routeResults[0].route)
mapRoute!!.isManeuverNumberVisible = true
mapRoute!!.zIndex = 3
mapRoute!!.tag = "0"
map!!.addMapObject(mapRoute!!)
geoBoundingBox = routeResults[0].route.boundingBox
geoBoundingBox!!
map!!.zoomTo(
geoBoundingBox!!, Map.Animation.NONE, 5f
)
timeDistanceForCL()
if (onPause == 1) {
startNavigation()
}
} else {
Toast.makeText(
this#Route,
"Error: route results returned is not valid",
Toast.LENGTH_LONG
).show()
}
if (routeResults[1].route != null) {
route = routeResults[1].route
mapRoute = MapRoute(routeResults[1].route)
mapRoute!!.isManeuverNumberVisible = true
mapRoute!!.color = ContextCompat.getColor(this#Route, R.color.gray_lines)
mapRoute!!.zIndex = 2
mapRoute!!.tag = "1"
map!!.addMapObject(mapRoute!!)
if (onPause == 1) {
startNavigation()
}
} else {
Toast.makeText(
this#Route,
"Error: route results returned is not valid",
Toast.LENGTH_LONG
).show()
}
if (routeResults[2].route != null) {
route = routeResults[2].route
mapRoute = MapRoute(routeResults[2].route)
mapRoute!!.isManeuverNumberVisible = true
mapRoute!!.color = ContextCompat.getColor(this#Route, R.color.gray_lines)
mapRoute!!.zIndex = 1
mapRoute!!.tag = "2"
map!!.addMapObject(mapRoute!!)
if (onPause == 1) {
startNavigation()
}
} else {
Toast.makeText(
this#Route,
"Error: route results returned is not valid",
Toast.LENGTH_LONG
).show()
}
} else {
Toast.makeText(
this#Route,
"Error: route calculation returned error code: $routingError",
Toast.LENGTH_LONG
).show()
}
}
})
When I add them to the map, I make the first route the normal color, then the other two are in grey and they have a lower zIndex as to not cover up the selected route.
I am using the MapGesture.OnGestureListener to determine when one of the routes is selected. Here is the code.
private val mapG: MapGesture.OnGestureListener = object : MapGesture.OnGestureListener.OnGestureListenerAdapter() {
override fun onMapObjectsSelected(p0: MutableList<ViewObject>): Boolean {
Log.d("onMapObjectsSelected", "onMapObjectsSelected ran")
for (p0 in routeResultsList) {
Log.d("onMapObjectsSelected", "onMapObjectsSelected for loop ran ran")
if (p0.route == routeResultsList[0].route){
Log.d("onMapObjectsSelected", "onMapObjectsSelected if(1) ran ran")
route = routeResultsList[0].route
mapRoute = MapRoute(routeResultsList[0].route)
mapRoute!!.isManeuverNumberVisible = true
mapRoute!!.zIndex = 3
map!!.addMapObject(mapRoute!!)
}
if (p0.route == routeResultsList[1].route){
Log.d("onMapObjectsSelected", "onMapObjectsSelected if(2) ran ran")
route = routeResultsList[1].route
mapRoute = MapRoute(routeResultsList[1].route)
mapRoute!!.isManeuverNumberVisible = true
mapRoute!!.zIndex = 3
map!!.addMapObject(mapRoute!!)
}
if (p0.route == routeResultsList[2].route){
Log.d("onMapObjectsSelected", "onMapObjectsSelected if(3) ran ran")
route = routeResultsList[2].route
mapRoute = MapRoute(routeResultsList[2].route)
mapRoute!!.isManeuverNumberVisible = true
mapRoute!!.zIndex = 3
map!!.addMapObject(mapRoute!!)
}
}
return super.onMapObjectsSelected(p0)
}
}
This code keeps the originally selected route [0] highlighted and I thought it was supposed to just highlight the other route that was selected. I haven't worked making the originally selected route grey yet, or update the time and distance at the top of the screen, but when I use the code, it runs all of the Log calls in it.
I'm calling private var mapGestures: MapGesture.OnGestureListener? = null
within the initMapFragmentView() where I have my other calls for NavigationListener.
private fun initMapFragmentView() {
val path = File(getExternalFilesDir(null), ".here-map-data")
.absolutePath
MapSettings.setDiskCacheRootPath(path)
val mapFragment = supportFragmentManager.findFragmentById(R.id.mapFragment) as AndroidXMapFragment?
val context = ApplicationContext(this).apply {
setAppIdCode(s, s1)
setLicenseKey(s2)
}
mapFragment?.let { fragment ->
fragment.init(context) { error ->
when (error) {
OnEngineInitListener.Error.NONE -> {
map = fragment.map
map?.run {
setCenter(
GeoCoordinate(36.9566664, -94.7881218, 0.0),
Map.Animation.NONE
)
setZoomLevel((maxZoomLevel + minZoomLevel) / 2)
}
navigationManager = NavigationManager.getInstance()
navigationManager!!.distanceUnit = NavigationManager.UnitSystem.IMPERIAL_US
navigationManager!!.addRerouteListener(
WeakReference(
mNavigaionRerouteListener
)
)
fragment.mapGesture?.addOnGestureListener(mapG, 0, true)
navigationManager!!.realisticViewMode = NavigationManager.RealisticViewMode.DAY
navigationManager!!.addRealisticViewAspectRatio(NavigationManager.AspectRatio.AR_4x3)
navigationManager!!.addRealisticViewListener(
WeakReference(viewListener))
voiceNavigation()
initNavigation()
}
else -> {
val errorMessage = "Error: ${error}, SDK Version: ${Version.getSdkVersion()}"
Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show();
}
}
}
}
}
Here is the link to the HERE Docs for the Gestures.
I'm not positive if the issue is with the onMapObjectsSelected for loop, or how I have the if statements set up, or something else? When I click on any either of the grey polyLines, then all 3 of them get highlighted instead of just the one that was selected.
UPDATE!!
I have made a few code changes trying to get this to work. In the process I have found out that the values are different for the same MapRoute. For example:
if (routeResults[0].route != null) {
route = routeResults[0].route
mapRoute = MapRoute(routeResults[0].route)
mapRoute0 = MapRoute(routeResults[0].route)
val toAdd = MapRoute(routeResults[0].route)
Log.d("onMapObjectsSelected", "mapRouteList0 $toAdd")
Log.d("onMapObjectsSelected", "mapRoute $mapRoute")
Log.d("onMapObjectsSelected", "mapRoute0 $mapRoute0")
mapRoute!!.isManeuverNumberVisible = true
mapRoute!!.zIndex = 3
mapRoute!!.tag = "0"
mapRouteList.add(toAdd)
map!!.addMapObject(mapRoute!!)
geoBoundingBox = routeResults[0].route.boundingBox
geoBoundingBox!!
map!!.zoomTo(
geoBoundingBox!!, Map.Animation.NONE, 5f
)
timeDistanceForCL()
if (onPause == 1) {
startNavigation()
}
}
This will print out these values:
2021-09-18 12:34:35.356 24400-24400/com.reedscodingandpublishingllc.truckparkingmore D/onMapObjectsSelected: mapRouteList0 com.here.android.mpa.mapping.MapRoute#c5f698ff
2021-09-18 12:34:35.356 24400-24400/com.reedscodingandpublishingllc.truckparkingmore D/onMapObjectsSelected: mapRoute com.here.android.mpa.mapping.MapRoute#c5f68e0f
2021-09-18 12:34:35.356 24400-24400/com.reedscodingandpublishingllc.truckparkingmore D/onMapObjectsSelected: mapRoute0 com.here.android.mpa.mapping.MapRoute#c5f6988f
I'm now trying to find out why the values are different for the same MapRoute(routeResults[0].route) ??
Am I misunderstanding how the MapRoute is named? Because when I go to click on a Route on the map, it comes back with a different value as well. Is there a better way to determine which route a user has selected?
The mapRoute = MapRoute(routeResults[0].route) statement in the above snippet is equivalent to MapRoute m_mapRoute = new MapRoute(route). As you have called the same method thrice, so it has created three different object.
For more details about the MapRoute class, please refer the below API reference document.
https://developer.here.com/documentation/android-premium/3.18/api_reference_java/index.html?com%2Fhere%2Fandroid%2Fmpa%2Fmapping%2FMapRoute.html
Please refer the standard routing and map-gestures implementation examples from the below HERE github repository.
https://github.com/heremaps/here-android-sdk-examples
I am trying to create an Akka Sharding Cluster. I want to use proxy only mode on one of the nodes just to route the message to the shard regions. I am getting the following Warning:
[WARN] [02/11/2019 17:04:17.819] [ClusterSystem-akka.actor.default-dispatcher-21] [akka.tcp://ClusterSystem#127.0.0.1:2555/system/sharding/ShardnameProxy] Trying to register to coordinator at [Some(ActorSelection[Anchor(akka.tcp://ClusterSystem#127.0.0.1:2551/), Path(/system/sharding/ShardnameCoordinator/singleton/coordinator)])], but no acknowledgement. Total [1] buffered messages.
**Main.java: ** Starts the cluster using the configuration from application.conf(code added latter)
object Main {
val shardName = "Shardname"
val role = "Master"
var shardingProbeLocalRegin: Option[ActorRef] = None
def main(args: Array[String]): Unit = {
val conf = ConfigFactory.load()
val system = ActorSystem("ClusterSystem",conf.getConfig("main"))
ClusterSharding(system).start(shardName,Test.props,ClusterShardingSettings(system),ShardDetails.extractEntityId,ShardDetails.extractShardId)
}
}
Test.java : Entity for the Sharding Cluster
object Test {
def props: Props = Props(classOf[Test])
class Test extends Actor {
val log = Logger.getLogger(getClass.getName)
override def receive = {
case msg: String =>
log.info("Message from " + sender().path.toString + " Message is " + msg)
sender() ! "Done"
}
}
}
MessageProducer.java(Proxy Only Mode) Message Producer sends a message to the Shard every second.
object MessageProducer {
var shardingProbeLocalRegin: Option[ActorRef] = None
object DoSharding
def prop:Props = Props(classOf[MessageProducer])
var numeric : Long = 0
def main(args: Array[String]): Unit = {
val conf = ConfigFactory.load
val system = ActorSystem("ClusterSystem",conf.getConfig("messgaeProducer"))
ClusterSharding(system).startProxy(Main.shardName,None,extractEntityId,extractShardId)
shardingProbeLocalRegin = Some(ClusterSharding(system).shardRegion(Main.shardName))
val actor = system.actorOf(Props[MessageProducer],"message")
}
}
class RemoteAddressExtensionImpl(system: ExtendedActorSystem) extends Extension {
def address = system.provider.getDefaultAddress
}
object RemoteAddressExtension extends ExtensionKey[RemoteAddressExtensionImpl]
class MessageProducer extends Actor{
val log = Logger.getLogger(getClass.getName)
override def preStart(): Unit = {
println("Starting "+self.path.address)
context.system.scheduler.schedule(10 seconds,1 second ,self,DoSharding)
}
override def receive = {
case DoSharding =>
log.info("sending message" + MessageProducer.numeric)
MessageProducer.shardingProbeLocalRegin.foreach(_ ! "" + (MessageProducer.numeric))
MessageProducer.numeric += 1
}
}
**application.conf: ** Configuration File
main {
akka {
actor {
provider = "akka.cluster.ClusterActorRefProvider"
}
remote {
log-remote-lifecycle-events = on
netty.tcp {
hostname = "127.0.0.1"
port = 2551
}
}
cluster {
seed-nodes = [
"akka.tcp://ClusterSystem#127.0.0.1:2551"
]
sharding.state-store-mode = ddata
auto-down-unreachable-after = 1s
}
akka.extensions = ["akka.cluster.metrics.ClusterMetricsExtension", "akka.cluster.ddata.DistributedData"]
}
}
messgaeProducer {
akka {
actor {
provider = "akka.cluster.ClusterActorRefProvider"
}
remote {
log-remote-lifecycle-events = on
netty.tcp {
hostname = "192.168.2.96"
port = 2554
}
}
cluster {
seed-nodes = [
"akka.tcp://ClusterSystem#127.0.0.1:2551"
//, "akka.tcp://ClusterSystem#127.0.0.1:2552"
]
sharding.state-store-mode = ddata
auto-down-unreachable-after = 1s
}
akka.extensions = ["akka.cluster.metrics.ClusterMetricsExtension", "akka.cluster.ddata.DistributedData"]
}
}
Am I doing anything wrong? Is there any other way to apply for this approach. My main aim is to avoid Single Point of failure for my cluster. If any node goes down then it should not affect any other state. Can anyone help me with this?
Is it solved?
If not, please check your akka.cluster configuration.
You have to set config like this. It works to me
for proxy
akka.cluster {
roles = ["Proxy"]
sharding {
role = "Master"
}
}
for master
akka.cluster {
roles = ["Master"]
sharding {
role = "Master"
}
}
I used xmppframewotk ios. connect delegate not working in swift 3. But socket is connected .
import XMPPFramework
inherited XMPPRosterDelegate,XMPPStreamDelegate
var xmppStream:XMPPStream!
let xmppRosterStorage = XMPPRosterCoreDataStorage()
var xmppRoster: XMPPRoster!
code:
func connect() -> Bool {
if xmppStream == nil {
xmppStream = XMPPStream()
xmppStream.addDelegate(self, delegateQueue: DispatchQueue.main)
}
if xmppStream.isDisconnected(){
if !(xmppStream?.isDisconnected())! {
return true
}
xmppStream?.myJID = XMPPJID.init(string: JABBERID)
xmppStream?.hostName = aHost
xmppStream?.hostPort = 5222
xmppStream?.enableBackgroundingOnSocket = true
do {
try xmppStream?.connect(withTimeout: XMPPStreamTimeoutNone)
print("Connection success")
return true
} catch {
print("Something went wrong!")
return false
}
} else {
return true
}
}
I have a Java Akka application and have now added the needed configuration to integrate it with the Typesafe Console and monitor the system. My system contains several remote nodes and it runs fine but the Typesafe Console doesn't get/show anything.
The common.conf I'm using is the following:
akka {
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote.netty.tcp.port = 0
remote.log-remote-lifecycle-events = off
loggers = ["akka.event.slf4j.Slf4jLogger", "com.typesafe.atmos.trace.Slf4jTraceContextLogger"]
loglevel = "INFO"
remote {
transport-failure-detector {
heartbeat-interval = 3 s
threshold = 10.0
max-sample-size = 100
min-std-deviation = 200 ms
acceptable-heartbeat-pause = 5 s
}
watch-failure-detector {
heartbeat-interval = 3 s
threshold = 12.0
max-sample-size = 200
min-std-deviation = 200 ms
acceptable-heartbeat-pause = 7 s
unreachable-nodes-reaper-interval = 3 s
expected-response-after = 6 s
}
}
}
atmos {
trace {
enabled = true
node = ${HOSTNAME}
traceable {
"*" = on
}
sampling {
"*" = 1
}
}
}
I find a bit fishy that the configuration of atmos does not require any references to where the Typesafe Console is running.
The application.conf I'm using is the following:
MapReduceSystem {
include "common"
akka {
actor {
deployment {
/mapActor {
router = round-robin
nr-of-instances = ${MAPREDUCE_NUMBER_OF_JOBS}
target.nodes = ["akka.tcp://MapReduceSystem#olympus:2552", "akka.tcp://MapReduceNode#zeus:2552", "akka.tcp://MapReduceNode#hera:2552"]
}
/reduceActor {
remote = "akka.tcp://MapReduceSystem#olympus:2552"
router = round-robin
nr-of-instances = 1
}
/masterActor {
remote = "akka.tcp://MapReduceSystem#olympus:2552"
nr-of-instances = 1
}
}
}
remote.netty.tcp.port = 2552
remote.enabled-transports = ["akka.remote.netty.tcp"]
remote.netty.tcp.hostname = "olympus"
}
}
MapReduceNode {
include "common"
akka {
remote.netty.tcp.port = 2552
remote.enabled-transports = ["akka.remote.netty.tcp"]
remote.netty.tcp.hostname = ${HOSTNAME}
}
}
UPDATE:
atmos log shows only this:
azg#olympus:~/code/hpcmom/hpcmom-mapreduce$ sudo $TYPESAFE_CONSOLE_ROOT/bin/typesafe-console atmos
2013-11-20 15:10:46,922 INFO [akka.event.slf4j.Slf4jEventHandler] [] [] : Slf4jEventHandler started
2013-11-20 15:10:46,954 INFO [U] [ActorSystem(query)] [query-akka.actor.default-dispatcher-2] : *** No license available. Defaulting to in-memory persistence. ***
2013-11-20 15:10:47,169 INFO [akka.event.slf4j.Slf4jEventHandler] [] [] : Slf4jEventHandler started
2013-11-20 15:10:47,199 INFO [akka.event.slf4j.Slf4jEventHandler] [] [] : Slf4jEventHandler started
2013-11-20 15:10:47,508 INFO [akka://query/user/IO-HTTP/listener-0] [akka://query/user/IO-HTTP/listener-0] [query-akka.actor.default-dispatcher-12] : Bound to olympus/192.168.92.21:8660
Since you import the common config in the MapReduceSystem context Atmos will not be able to find the atmos configuration section. It expects the atmos configuration at the root level.
Try adding the atmos section directly to the application.conf file instead.