Beispiel #1
0
int console_add_host___link(lua_State *L) {
  s_sg_platf_host_link_cbarg_t hostlink;
  memset(&hostlink,0,sizeof(hostlink));
  int type;

  lua_ensure(lua_istable(L, -1),
      "Bad Arguments to create host_link in Lua. Should be a table with named arguments.");

  lua_pushstring(L, "id");
  type = lua_gettable(L, -2);
  lua_ensure(type == LUA_TSTRING, "Attribute 'id' must be specified for any host_link and must be a string.");
  hostlink.id = lua_tostring(L, -1);
  lua_pop(L, 1);

  lua_pushstring(L, "up");
  type = lua_gettable(L, -2);
  lua_ensure(type == LUA_TSTRING || type == LUA_TNUMBER,
      "Attribute 'up' must be specified for host_link and must either be a string or a number.");
  hostlink.link_up = lua_tostring(L, -1);
  lua_pop(L, 1);

  lua_pushstring(L, "down");
  type = lua_gettable(L, -2);
  lua_ensure(type == LUA_TSTRING || type == LUA_TNUMBER,
      "Attribute 'down' must be specified for host_link and must either be a string or a number.");
  hostlink.link_down = lua_tostring(L, -1);
  lua_pop(L, 1);

  XBT_DEBUG("Create a host_link for host %s", hostlink.id);
  sg_platf_new_hostlink(&hostlink);

  return 0;
}
Beispiel #2
0
void STag_surfxml_host___link(){
  XBT_DEBUG("Create a Host_link for %s",A_surfxml_host___link_id);
  simgrid::kernel::routing::HostLinkCreationArgs host_link;

  host_link.id        = A_surfxml_host___link_id;
  host_link.link_up   = A_surfxml_host___link_up;
  host_link.link_down = A_surfxml_host___link_down;
  sg_platf_new_hostlink(&host_link);
}