int32_t crm_port_attribute_getexactrec (struct cm_array_of_iv_pairs * keys_arr_p,
    struct cm_array_of_iv_pairs ** pIvPairArr)

{
  struct   cm_array_of_iv_pairs *result_iv_pairs_p = NULL;
  int32_t  return_value = OF_FAILURE;
  struct   crm_attribute_name_value_pair crm_attribute_name_value_info={};
  char     port_name[CRM_MAX_VM_NAME_LEN+1]={};
  uint64_t port_handle;

  CM_CBK_DEBUG_PRINT ("Entered");

  of_memset(port_name, 0, sizeof(port_name));
  result_iv_pairs_p =
                     (struct cm_array_of_iv_pairs *) of_calloc (1, sizeof (struct cm_array_of_iv_pairs));
  if (result_iv_pairs_p == NULL)
   {
     CM_CBK_DEBUG_PRINT ("Failed to allocate memory for result_iv_pairs_p");
     return OF_FAILURE;
   }

  of_memset (&crm_attribute_name_value_info, 0, sizeof (struct crm_attribute_name_value_pair));

  if ((crm_port_attribute_ucm_setmandparams (keys_arr_p,port_name, &crm_attribute_name_value_info, 
	      NULL)) != OF_SUCCESS)
   {
     CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
     return OF_FAILURE;
   }
   return_value = crm_get_port_handle(port_name, &port_handle);
   if (return_value != OF_SUCCESS)
    {
      CM_CBK_DEBUG_PRINT ("port does not exist with name %s",port_name);
      return OF_FAILURE;
    }

  return_value = crm_get_port_exact_attribute(port_name, crm_attribute_name_value_info.name_string);
    if (return_value != OF_SUCCESS)
     {
       CM_CBK_DEBUG_PRINT ("Unable to find  exact attribute record!");
       return OF_FAILURE;
     }

  crm_attribute_port_getparams (&crm_attribute_name_value_info, result_iv_pairs_p);
  *pIvPairArr = result_iv_pairs_p;
  return return_value;
}
int32_t of_fw4_conntemplates_addrec (void * config_trans_p,
                        struct cm_array_of_iv_pairs * pMandParams,
                        struct cm_array_of_iv_pairs * pOptParams,
                        struct cm_app_result ** result_p)
{
  struct cm_app_result *result = NULL;
  int32_t               return_value = OF_FAILURE;
  struct fw4_conn_templates_config config_info={};
  uint64_t                    conn_template_handle;
  
  CM_CBK_DEBUG_PRINT ("Entered");
  
  if((of_fw4_conntemplates_setmandparams(
                               pMandParams, 
                               &config_info, 
                               &result)) != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT("Set Mandatory Parameters Failed");
    fill_app_result_struct(&result, NULL, CM_GLU_SET_MAND_PARAM_FAILED);
    *result_p = result;
    return OF_FAILURE;
  }

  if((of_fw4_conntemplates_setoptparams(
                               pOptParams, 
                               &config_info, 
                               &result)) != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT("Set Optional Parameters Failed");
    fill_app_result_struct(&result, NULL, CM_GLU_SET_OPT_PARAM_FAILED);
    *result_p = result;
    return OF_FAILURE;
  }

  return_value = fw4_add_conn_templates(
                                  &config_info,  
                                  &conn_template_handle);
  if (return_value != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("connection template  add record Failed");
    fill_app_result_struct (&result, NULL, CM_GLU_CONN_TEMPLATE_ADD_FAILED);
    *result_p = result;
    return OF_FAILURE;
  }
  CM_CBK_DEBUG_PRINT ("connection template record added successfully");
  return OF_SUCCESS;
}
Example #3
0
int32_t UCMDP_DelRecord(uint32_t uiAppId,void * config_trans_p,
			struct cm_array_of_iv_pairs * keys_arr_p,
			struct cm_app_result ** result_p)
{
	 char *pTempBuf;;
	 int32_t iTotalLen=0,return_value;
	 uint32_t uiLen=0;
	 struct cm_app_result *app_result_p=NULL;
	 ucmcommmsg_t CommMsg={};

	 pTempBuf=CommMsg.cntlreqmsg.msg;
	 CM_CBK_DEBUG_PRINT(" Entry uiAppId=%d",uiAppId);


#if defined(_LP64)
	 pTempBuf= of_mbuf_put_64(pTempBuf, (unsigned long)config_trans_p);
#else
	 pTempBuf= of_mbuf_put_32(pTempBuf, (uint32_t) config_trans_p);
#endif
	 iTotalLen+=sizeof(long);
	 if(cm_je_copy_ivpair_arr_to_buffer(keys_arr_p,pTempBuf,&uiLen)!=OF_SUCCESS)
	 {
			CM_CBK_DEBUG_PRINT("cm_je_copy_ivpair_arr_to_buffer Failed");
			return OF_FAILURE;
	 }
	 pTempBuf+=uiLen;
	 iTotalLen+=uiLen;

	 app_result_p = (struct cm_app_result *)of_calloc(1,sizeof(struct cm_app_result));
	 if(!app_result_p)
	 {
			CM_CBK_DEBUG_PRINT("memory allocation failed");
			return OF_FAILURE;
	 }  

	 CM_CNTRL_PREPARE_CNTRL_CFG_REQUEST(CommMsg.cntlreqmsg, uiAppId, 0, CM_CPDP_APPL_DEL_CMD, sizeof(long), iTotalLen);
	 return_value=UCMCntrlCommHandler(&CommMsg,app_result_p);

	 if(return_value == OF_SUCCESS)
	 {
			of_free(app_result_p);
			return OF_SUCCESS;
	 }

	 *result_p = app_result_p;
	 return return_value;
}
int32_t crm_port_attribute_setrec (void * config_trans_p,
		  		     struct cm_array_of_iv_pairs * pMandParams,
			             struct cm_array_of_iv_pairs * pOptParams,
			             struct cm_app_result ** result_p)
{
  struct   cm_app_result *attribute_result = NULL;
  struct   crm_attribute_name_value_pair crm_attribute_name_value_info={};
  char port_name[CRM_MAX_VM_NAME_LEN+1];

  uint64_t port_handle;
  int32_t  return_value = OF_FAILURE,result;

  CM_CBK_DEBUG_PRINT ("Entered");

  of_memset (&crm_attribute_name_value_info, 0, sizeof (struct crm_attribute_name_value_pair));

  of_memset(port_name, 0, sizeof(port_name));
  if ((crm_port_attribute_ucm_setmandparams (pMandParams, 
	      port_name, &crm_attribute_name_value_info, 
	      &attribute_result)) != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
    fill_app_result_struct (&attribute_result, NULL, CM_GLU_SET_MAND_PARAM_FAILED);
    *result_p = attribute_result;
    return OF_FAILURE;
  }

  return_value = crm_get_port_handle(port_name, &port_handle);
  if (return_value != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("port does not exist with name %s",port_name);
    fill_app_result_struct (&attribute_result, NULL, CM_GLU_VM_NAME_NULL);
    *result_p = attribute_result;
    return OF_FAILURE;
  }
  return_value = crm_add_attribute_to_port(port_name, &crm_attribute_name_value_info);
  if (return_value != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Attribute modification failed");
    fill_app_result_struct (&attribute_result, NULL, CM_GLU_ATTRIBUTE_ADD_FAILED);
    *result_p = attribute_result;
    return OF_FAILURE;
  }
  CM_CBK_DEBUG_PRINT ("Attribute modifed succesfully");
  return OF_SUCCESS;

}
Example #5
0
int32_t dprm_datapath_get_first_asyncmsgcfg (struct cm_array_of_iv_pairs * key_iv_pairs_p,
    struct cm_array_of_iv_pairs ** result_iv_pairs_pp)
{
  int32_t return_value = OF_FAILURE;

  CM_CBK_DEBUG_PRINT ("Entered");
  return return_value;
}
Example #6
0
int32_t nsrm_appliance_init (void)
{
  CM_CBK_DEBUG_PRINT ("Entry");
  if (cm_register_app_callbacks (CM_ON_DIRECTOR_NSRM_SERVICE_APPL_ID, &nsrm_appliance_callbacks) != OF_SUCCESS)
    return OF_FAILURE;

  return OF_SUCCESS;
}
Example #7
0
int32_t nsrm_bypassrule_verifycfg (struct cm_array_of_iv_pairs *key_iv_pairs_p,
                        uint32_t command_id, struct cm_app_result ** result_p)
{
  struct cm_app_result *of_bypassrule_result = NULL;
  int32_t return_value = OF_FAILURE;

  CM_CBK_DEBUG_PRINT ("Entered");
  return_value = nsrm_bypassrule_ucm_validatemandparams(key_iv_pairs_p, &of_bypassrule_result);
  if (return_value != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Validate Mandatory Parameters Failed");
    return OF_FAILURE;
  }
  *result_p = of_bypassrule_result;
  return OF_SUCCESS;

}
Example #8
0
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Function Name:
 * Description:
 * Input:
 * Output:
 * Result:
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32_t of_action_verifycfg (struct cm_array_of_iv_pairs * key_iv_pairs,
		uint32_t command_id, struct cm_app_result ** result_pp)
{
	struct cm_app_result *of_action_result = NULL;
	int32_t return_value = OF_FAILURE;

	CM_CBK_DEBUG_PRINT ("Entered");

	return_value = of_action_ucm_validate_mand_params (key_iv_pairs, &of_action_result);
	if (return_value != OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("Validate Mandatory Parameters Failed");
	        *result_pp = of_action_result;
		return OF_FAILURE;
	}
	return OF_SUCCESS;
}
Example #9
0
int32_t crm_nwport_attribute_verifycfg (struct cm_array_of_iv_pairs * keys_arr_p,
			uint32_t command_id, struct cm_app_result ** result_p)
{
  struct cm_app_result *attribute_result = NULL;
  int32_t return_value = OF_FAILURE;

  CM_CBK_DEBUG_PRINT ("Entered");

  return_value = crm_nwport_attribute_ucm_validatemandparams (keys_arr_p, &attribute_result);
  if (return_value != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Validate Mandatory Parameters Failed");
    return OF_FAILURE;
  }
  *result_p = attribute_result;
  return OF_SUCCESS;
}
Example #10
0
int32_t nsrm_bypassrule_init (void)
{
  CM_CBK_DEBUG_PRINT ("Entry");
  if (cm_register_app_callbacks (CM_ON_DIRECTOR_NSRM_CHAIN_BYPASSRULE_APPL_ID, &nsrm_bypassrule_callbacks) != OF_SUCCESS)
    return OF_FAILURE;

  return OF_SUCCESS;
}
Example #11
0
int32_t nsrm_selection_rule_attribute_appl_ucmcbk_init (void)
{
    CM_CBK_DEBUG_PRINT ("Entry");
    if(cm_register_app_callbacks (CM_ON_DIRECTOR_NSRM_CHAINSET_CHAINSELRULE_CHAINSELECTIONATTRIBUTE_APPL_ID, &nsrm_selection_rule_attribute_ucm_callbacks) != OF_SUCCESS)
        return OF_FAILURE;

    return OF_SUCCESS;
}
Example #12
0
int32_t of_bindstats_getexactrec (struct cm_array_of_iv_pairs * pKeysArr,
    struct cm_array_of_iv_pairs ** pIvPairArr)
{

  CM_CBK_DEBUG_PRINT ("Entered");
  return OF_FAILURE;

}
Example #13
0
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Function Name:
 * Description:
 * Input:
 * Output:
 * Result:
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32_t of_flow_actionset_setrec (void * config_trans_p,
		struct cm_array_of_iv_pairs * mand_iv_pairs,
		struct cm_array_of_iv_pairs * opt_iv_pairs,
		struct cm_app_result ** result_pp)
{
	struct cm_app_result *of_flow_actionset_result = NULL;
	int32_t return_value = OF_SUCCESS;
	struct flow_trans *trans_rec=config_trans_p;
  struct ofi_flow_action flow_action_info = {};
  struct ofi_flow_mod_info flow_info = {};


	CM_CBK_DEBUG_PRINT ("Entered");
  if(of_flow_actionset_ucm_setmandparams(mand_iv_pairs, NULL, &flow_info, 
                                         &flow_action_info, 
                                         &of_flow_actionset_result) != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
    *result_pp=of_flow_actionset_result;
    return OF_FAILURE;
  }

  return_value = of_flow_actionset_ucm_setoptparams(opt_iv_pairs, 
                                                    &flow_action_info, 
                                                    &of_flow_actionset_result);
  if (return_value != OF_SUCCESS)
  {
     CM_CBK_DEBUG_PRINT ("Error: flow does not exist with flow id %d",flow_info.flow_id);
     fill_app_result_struct (&of_flow_actionset_result, NULL, CM_GLU_VLAN_FAILED);
     *result_pp =of_flow_actionset_result;
     return OF_FAILURE;
  }

  return_value = of_flow_update_actionset(trans_rec->datapath_handle,
                                          flow_info.flow_id,
                                          &flow_action_info); 
  if (return_value != OF_SUCCESS)
  {
     CM_CBK_DEBUG_PRINT ("Error: failed to update inst in flow table id=%d",flow_info.flow_id);
     fill_app_result_struct(&of_flow_actionset_result, NULL, CM_GLU_VLAN_FAILED);
     *result_pp =of_flow_actionset_result;
     return OF_FAILURE;
  }

  return return_value;
}
Example #14
0
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Function Name:
 * Description:
 * Input:
 * Output:
 * Result:
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32_t of_flow_setrec (void * config_trans_p,
		struct cm_array_of_iv_pairs * mand_iv_pairs,
		struct cm_array_of_iv_pairs * opt_iv_pairs,
		struct cm_app_result ** result_pp)
{
	struct cm_app_result *flow_result = NULL;
	int32_t return_value = OF_FAILURE;
	struct ofi_flow_mod_info flow_info = { };
	struct dprm_datapath_general_info datapath_info={};
	uint64_t datapath_handle;

	CM_CBK_DEBUG_PRINT ("Entered");
   	return OF_SUCCESS;
	memset (&flow_info, 0, sizeof (struct ofi_flow_mod_info));

	if ((of_flow_ucm_setmandparams (mand_iv_pairs,&datapath_info, &flow_info, &flow_result)) !=
			OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
		*result_pp=flow_result;
		return OF_FAILURE;
	}

	return_value=dprm_get_datapath_handle(datapath_info.dpid, &datapath_handle);
	if (return_value != OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("Datapath does not exist with id %llx",datapath_info.dpid);
		fill_app_result_struct (&flow_result, NULL, CM_GLU_GROUP_DATAPATH_DOESNOT_EXIST);
		*result_pp = flow_result;
		return OF_FAILURE;
	}

    #if 0 //need to check with atmaram
	return_value = of_group_unregister_buckets(datapath_handle, flow_info.flow_id);
	if (return_value != OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("Flow does not exist with name %d",flow_info.flow_id);
		fill_app_result_struct (&flow_result, NULL, CM_GLU_FLOW_DOESNOT_EXIST);
		*result_pp =flow_result;
		return OF_FAILURE;
	}
    #endif


	return OF_SUCCESS;
}
Example #15
0
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Function Name:
 * Description:
 * Input:
 * Output:
 * Result:
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32_t of_action_getnextnrecs (struct cm_array_of_iv_pairs * key_iv_pairs,
		struct cm_array_of_iv_pairs *pPrevRecordKey, uint32_t * pCount,
		struct cm_array_of_iv_pairs ** pNextNRecordData_p)
{
	CM_CBK_DEBUG_PRINT ("no next records");
	*pCount=0;
	return OF_FAILURE;
}
Example #16
0
int32_t tsc_selectors_modrec(void * config_trans_p,
                             struct cm_array_of_iv_pairs * pMandParams,
                             struct cm_array_of_iv_pairs * pOptParams,
                             struct cm_app_result ** result_p)
{
  struct cm_app_result          *app_result = NULL;
  struct cm_array_of_iv_pairs   *result_iv_pairs_p = NULL;
  struct nsc_selector_node_key  *key_p = NULL;  

  int32_t retval = OF_FAILURE;
  CM_CBK_DEBUG_PRINT ("Entered addrec"); 
  key_p = (struct nsc_selector_node_key*)calloc(1,sizeof(struct nsc_selector_node_key));
  key_p->vn_name = (char*)calloc(1,128);


  if(tsc_selectors_ucm_setmandparams(pMandParams,key_p) != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
    fill_app_result_struct (&app_result, NULL, CM_GLU_SET_MAND_PARAM_FAILED);
    free(key_p->vn_name);
    free(key_p);
    return OF_FAILURE;
  }


  if(tsc_selectors_ucm_setoptparams(pOptParams,key_p) != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Set Optional Parameters Failed");
    fill_app_result_struct (&app_result, NULL, CM_GLU_SET_OPT_PARAM_FAILED);
    free(key_p->vn_name);
    free(key_p);
    return OF_FAILURE;
  }
 
  global_key_p = key_p;
 
  retval = tsc_add_selector_key(key_p);
  if(retval != TSC_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Add Failed");
    free(key_p->vn_name);
    free(key_p);
    return OF_FAILURE;
  }
  return OF_SUCCESS;
}
int32_t of_fw4_conntemplates_getexactrec(
     struct cm_array_of_iv_pairs * key_iv_pairs_p,
     struct cm_array_of_iv_pairs ** pIvPairArr)
{

  struct cm_array_of_iv_pairs *result_iv_pairs_p = NULL;
  struct cm_app_result *result = NULL;
  struct fw4_conn_templates_config  config_info={};
  int32_t return_value = OF_FAILURE;
  uint64_t conn_template_handle;

  CM_CBK_DEBUG_PRINT ("Entered");
  of_memset (&config_info, 0, sizeof(config_info));

  if ((of_fw4_conntemplates_setmandparams(key_iv_pairs_p, 
                                    &config_info, 
                                    &result)) != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT("Set Mandatory Parameters Failed");
    return OF_FAILURE;
  }

  return_value = fw4_get_exact_conn_template(&config_info, 
                                   &conn_template_handle);
  if (return_value != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Error: template doesn't exists");
    return OF_FAILURE;
  }


  CM_CBK_DEBUG_PRINT ("Exact matching record found");
  result_iv_pairs_p =
    (struct cm_array_of_iv_pairs *) of_calloc (1, sizeof (struct cm_array_of_iv_pairs));

  if (result_iv_pairs_p == NULL)
  {
    CM_CBK_DEBUG_PRINT ("Failed to allocate memory for result_iv_pairs_p");
    return OF_FAILURE;
  }

  of_fw4_conntemplates_getparams(&config_info, 
                                 result_iv_pairs_p);
  *pIvPairArr = result_iv_pairs_p;
  return OF_SUCCESS;
}
Example #18
0
int32_t nsrm_appliance_getfirstnrecs (struct cm_array_of_iv_pairs * keys_arr_p,
                        uint32_t * count_p,
                        struct cm_array_of_iv_pairs ** array_of_iv_pair_arr_p)
{
  struct cm_array_of_iv_pairs *result_iv_pairs_p = NULL;
  int32_t return_value = OF_FAILURE;
  uint32_t uiRecCount = 0;
  int32_t uiRecquestedCount = 1, uiReturnedCnt=0;
  struct nsrm_nwservice_object_record *nsrm_appliance_config_info=NULL;

  CM_CBK_DEBUG_PRINT ("Entered");

  nsrm_appliance_config_info = (struct  nsrm_nwservice_object_record*)of_calloc(1,sizeof(struct  nsrm_nwservice_object_record));
  nsrm_appliance_config_info->info = (struct nsrm_nwservice_object_config_info*)of_calloc(NSRM_MAX_NWSERVICE_OBJECT_CONFIG_PARAMETERS,sizeof(struct nsrm_nwservice_object_config_info));

  nsrm_appliance_config_info->key.name_p = (char*)of_calloc(1,128);
  nsrm_appliance_config_info->key.tenant_name_p = (char*)of_calloc(1,128);
  
 return_value = nsrm_get_first_nwservice_objects(uiRecquestedCount, 
                 &uiReturnedCnt, nsrm_appliance_config_info);
 if (return_value != OF_SUCCESS)
 {
   CM_CBK_DEBUG_PRINT ("Get first record failed for NSRM appliance  Table");
   return OF_FAILURE;
 }

  result_iv_pairs_p = (struct cm_array_of_iv_pairs *) of_calloc (1, sizeof (struct cm_array_of_iv_pairs));
 if (result_iv_pairs_p == NULL)
 {
   CM_CBK_DEBUG_PRINT ("Memory allocation failed for result_iv_pairs_p");
   of_free(nsrm_appliance_config_info->key.name_p);
   of_free(nsrm_appliance_config_info->key.tenant_name_p);
   of_free(nsrm_appliance_config_info);
   of_free(nsrm_appliance_config_info->info);
   return OF_FAILURE;
 }
  nsrm_appliance_ucm_getparams (nsrm_appliance_config_info, &result_iv_pairs_p[uiRecCount]);
  uiRecCount++;
 *array_of_iv_pair_arr_p = result_iv_pairs_p;
  of_free(nsrm_appliance_config_info->key.name_p);
  of_free(nsrm_appliance_config_info->key.tenant_name_p);
  of_free(nsrm_appliance_config_info);
  of_free(nsrm_appliance_config_info->info);
  return OF_SUCCESS;
}
Example #19
0
int32_t of_nem_peth2dpid_getnextnrecs (struct cm_array_of_iv_pairs * key_iv_pairs_p,
      struct cm_array_of_iv_pairs *prev_record_key_p, uint32_t * count_p,
      struct cm_array_of_iv_pairs ** next_n_record_data_p)
{

   struct cm_array_of_iv_pairs *result_iv_pairs_p = NULL;
   struct cm_app_result *app_result_p = NULL;
   struct of_nem_dp_peth_info nem_map_info;
   uint64_t nem_db_entry_handle;
   int32_t ret_val = OF_FAILURE;
   uint32_t uiRecCount = 0;

   CM_CBK_DEBUG_PRINT ("Entered");
   of_memset (&nem_map_info, 0, sizeof (struct of_nem_dp_peth_info));

   if ((of_nem_peth2dpid_ucm_setmandparams (prev_record_key_p, &nem_map_info, &app_result_p)) !=
         OF_SUCCESS)
   {
      CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
      return OF_FAILURE;
   }

   ret_val=of_nem_peth_2_dpid_db_get_map_entry_handle(nem_map_info.ns_id, nem_map_info.peth_name, &nem_db_entry_handle);
   if (ret_val != OF_SUCCESS)
   {
      CM_CBK_DEBUG_PRINT ("Error: nem entry does not exist with dpid  %llx portname %s",nem_map_info.dp_id, nem_map_info.port_name);
      return OF_FAILURE;
   }

   of_memset (&nem_map_info, 0, sizeof (struct of_nem_dp_peth_info));
   ret_val=of_nem_peth_2_dpid_db_get_next_map_entry(&nem_map_info, &nem_db_entry_handle);
   if (ret_val != OF_SUCCESS)
   {
      CM_CBK_DEBUG_PRINT ("failed");
      *count_p = 0;
      return OF_FAILURE;
   }
   result_iv_pairs_p =
      (struct cm_array_of_iv_pairs *) of_calloc (1, sizeof (struct cm_array_of_iv_pairs));

   if (result_iv_pairs_p == NULL)
   {
      CM_CBK_DEBUG_PRINT ("Memory allocation failed for result_iv_pairs_p");
      return OF_FAILURE;
   }
   CM_CBK_DEBUG_PRINT ("Next Nsid record is : %d ",
         nem_map_info.ns_id);
   of_nem_peth2dpid_ucm_getparams (&nem_map_info, &result_iv_pairs_p[uiRecCount]);
   uiRecCount++;
   CM_CBK_DEBUG_PRINT ("Number of records requested were %d ", *count_p);
   CM_CBK_DEBUG_PRINT ("Number of records found are %d", uiRecCount+1);
   *next_n_record_data_p = result_iv_pairs_p;
   *count_p = uiRecCount;
   return OF_SUCCESS;
}
Example #20
0
int32_t of_flowstats_getexactrec (struct cm_array_of_iv_pairs * pKeysArr,
    struct cm_array_of_iv_pairs ** pIvPairArr)
{
  int32_t return_value = OF_FAILURE;

  CM_CBK_DEBUG_PRINT ("Entered");
  return return_value;

}
Example #21
0
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Function Name:
 * Description:
 * Input:
 * Output:
 * Result:
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32_t of_flow_actionset_delrec (void * config_trans_p,
		struct cm_array_of_iv_pairs * key_iv_pairs,
		struct cm_app_result ** result_pp)
{
	struct cm_app_result *of_flow_actionset_result = NULL;
	int32_t return_value = OF_FAILURE;
	struct ofi_flow_mod_info flow_info = { };
	struct ofi_flow_action flow_action_info={};
	struct flow_trans *trans_rec=config_trans_p;

	CM_CBK_DEBUG_PRINT ("Entered");
	return OF_FAILURE;

	of_memset (&flow_action_info, 0, sizeof (struct ofi_flow_action));
	if ( trans_rec->command_id != CM_CMD_DEL_PARAMS)
	{
		CM_CBK_DEBUG_PRINT ("Delete not supported");
		return OF_FAILURE;
	}

    if ((of_flow_actionset_ucm_setmandparams (key_iv_pairs, NULL,
                                     &flow_info, &flow_action_info,
                                     &of_flow_actionset_result)) != OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
		fill_app_result_struct (&of_flow_actionset_result, NULL, CM_GLU_VLAN_FAILED);
		*result_pp =of_flow_actionset_result;
		return OF_FAILURE;
	}

	return_value = of_flow_remove_action_from_list(trans_rec->datapath_handle,
                                        flow_info.flow_id,
                                        flow_action_info.action_id);
	if (return_value != OF_SUCCESS)
	{
      CM_CBK_DEBUG_PRINT("Error: flow_actionset does not exist with id %d",
                          flow_action_info.action_type);
      fill_app_result_struct (&of_flow_actionset_result, NULL, CM_GLU_VLAN_FAILED);
      *result_pp =of_flow_actionset_result;
      return OF_FAILURE;
	}

	return OF_SUCCESS;
}
Example #22
0
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Function Name:
 * Description:
 * Input:
 * Output:
 * Result:
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32_t of_action_ucm_set_mand_params (struct cm_array_of_iv_pairs *
		mand_iv_pairs,
		struct  ofi_group_desc_info *group_info,
		struct ofi_bucket *bucket_info,
		struct ofi_action *action_info,
		struct cm_app_result ** result_pp)
{
	uint32_t param_count;
	uint32_t group_id;
	uint32_t bucket_id;
	char *action_type;
	uint32_t action_type_len;

	CM_CBK_DEBUG_PRINT ("Entered");
	for (param_count = 0; param_count < mand_iv_pairs->count_ui;
			param_count++)
	{
		switch (mand_iv_pairs->iv_pairs[param_count].id_ui)
		{
			case CM_DM_GROUPDESC_GROUP_ID_ID:
				group_id=of_atoi((char *) mand_iv_pairs->iv_pairs[param_count].value_p);
				group_info->group_id=group_id;
				CM_CBK_DEBUG_PRINT ("group id is %d", group_id);
				break;
			case  CM_DM_BUCKET_BUCKETID_ID:
				bucket_id=of_atoi((char *) mand_iv_pairs->iv_pairs[param_count].value_p);
				bucket_info->bucket_id=bucket_id;
				CM_CBK_DEBUG_PRINT ("bucket id %d", bucket_id);
				break;
			case  CM_DM_ACTION_TYPE_ID:
				action_type=((char *) mand_iv_pairs->iv_pairs[param_count].value_p);
				action_type_len = (mand_iv_pairs->iv_pairs[param_count].value_length);
				of_group_set_action_type(action_info,action_type,action_type_len);

				//action_info->type=(uint16_t )action_type;
				CM_CBK_DEBUG_PRINT ("action type %d %s ",action_info->type,action_type);
				break;


		}
	}
	CM_CBK_PRINT_IVPAIR_ARRAY (mand_iv_pairs);
	return OF_SUCCESS;
}
Example #23
0
int32_t nsrm_appliance_addrec (void * config_trans_p,
                        struct cm_array_of_iv_pairs * pMandParams,
                        struct cm_array_of_iv_pairs * pOptParams,
                        struct cm_app_result ** result_p)
{

   struct cm_app_result *nsrm_appliance_result = NULL;
   int32_t return_value = OF_FAILURE;
   struct nsrm_nwservice_object_key *nsrm_appliance_key_info;
   struct nsrm_nwservice_object_config_info *nsrm_appliance_config_info = NULL;

   CM_CBK_DEBUG_PRINT ("Entered(nsrm_appliance_addrec)");

  nsrm_appliance_key_info = (struct nsrm_nwservice_object_key *) of_calloc(1, sizeof(struct nsrm_nwservice_object_key ));
  nsrm_appliance_config_info = (struct nsrm_nwservice_object_config_info*)of_calloc(NSRM_MAX_NWSERVICE_OBJECT_CONFIG_PARAMETERS,sizeof(struct nsrm_nwservice_object_config_info));
  if ((nsrm_appliance_ucm_setmandparams (pMandParams, nsrm_appliance_key_info, nsrm_appliance_config_info)) != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
    fill_app_result_struct (&nsrm_appliance_result, NULL, CM_GLU_SET_MAND_PARAM_FAILED);
    *result_p=nsrm_appliance_result;
    of_free(nsrm_appliance_key_info->name_p);
    of_free(nsrm_appliance_key_info->tenant_name_p);
    of_free(nsrm_appliance_key_info);
    return OF_FAILURE;
  }
  

  if ((nsrm_appliance_ucm_setoptparams (pOptParams, nsrm_appliance_config_info)) != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Set Optional Parameters Failed");
    fill_app_result_struct (&nsrm_appliance_result, NULL, CM_GLU_SET_OPT_PARAM_FAILED);
    *result_p=nsrm_appliance_result;
    of_free(nsrm_appliance_key_info->name_p);
    of_free(nsrm_appliance_key_info->tenant_name_p);
    of_free(nsrm_appliance_key_info);
    return OF_FAILURE;
  }

 CM_CBK_DEBUG_PRINT("nsrm_appliance_config_info :%d",nsrm_appliance_config_info[0].value.nwservice_object_form_factor_type_e);
 CM_CBK_DEBUG_PRINT("nsrm_appliance_config_info :%d",nsrm_appliance_config_info[1].value.admin_status_e);

  return_value =nsrm_add_nwservice_object(2, nsrm_appliance_key_info,
                                         nsrm_appliance_config_info);
  if (return_value != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("nsrm appliance add  Failed");
    fill_app_result_struct (&nsrm_appliance_result, NULL, CM_GLU_APPLIANCE_ADD_FAILED);
    *result_p = nsrm_appliance_result;
    of_free(nsrm_appliance_key_info->name_p);
    of_free(nsrm_appliance_key_info->tenant_name_p);
    of_free(nsrm_appliance_key_info);
    return OF_FAILURE;
  }
  CM_CBK_DEBUG_PRINT ("NSRM appliance added successfully");
  of_free(nsrm_appliance_key_info->name_p);
  of_free(nsrm_appliance_key_info->tenant_name_p);
  of_free(nsrm_appliance_key_info);
  return OF_SUCCESS;
}
Example #24
0
int32_t of_cntlrrole_getexactrec (struct cm_array_of_iv_pairs * pKeysArr,
		struct cm_array_of_iv_pairs ** pIvPairArr)
{
	struct   dprm_datapath_general_info datapath_info={};
	uint64_t datapath_handle;
	int32_t  iRetVal;  
	struct   cm_array_of_iv_pairs *result_iv_pairs_p=NULL;
        uint8_t  controller_role;

	CM_CBK_DEBUG_PRINT ("Entered");

	if ((of_cntlrrole_ucm_setmandparams (pKeysArr, &datapath_info, NULL)) !=
			OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
		return OF_FAILURE;
	}


	iRetVal = dprm_get_datapath_handle(datapath_info.dpid, &datapath_handle);
	if (iRetVal != OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("dprm_get_datapath_handle");
		return OF_FAILURE;
	}
	iRetVal = dprm_get_datapath_controller_role(datapath_handle, &controller_role);
        if(iRetVal  != DPRM_SUCCESS)
        {
           CM_CBK_DEBUG_PRINT("Error in getting datapath  ONDirector role");
           return OF_FAILURE;
        }

	CM_CBK_DEBUG_PRINT("ONDirector_role:%d\n",controller_role);
	result_iv_pairs_p = (struct cm_array_of_iv_pairs *) of_calloc (1, sizeof (struct cm_array_of_iv_pairs));
	if (result_iv_pairs_p == NULL)
	{
		cntrlrucm_debugmsg("memory allocation failed");
		return OF_FAILURE;
	}

	of_cntlrrole_getparams(controller_role, result_iv_pairs_p);
        *pIvPairArr = result_iv_pairs_p;
	return OF_SUCCESS;
}
Example #25
0
int32_t crm_nwport_attribute_getfirstnrecs(struct cm_array_of_iv_pairs * keys_arr_p,
		uint32_t * count_p,
		struct cm_array_of_iv_pairs ** array_of_iv_pair_arr_p)
{
  struct cm_array_of_iv_pairs *result_iv_pairs_p = NULL;
  struct   crm_attribute_name_value_pair crm_attribute_name_value_info={};
  struct   crm_attribute_name_value_output_info crm_attribute_output={};
  char nwport_name[CRM_MAX_VM_NAME_LEN+1]={};

  int32_t return_value = OF_FAILURE;
  uint32_t uiRecCount = 0;

  CM_CBK_DEBUG_PRINT ("Entered");

  of_memset (&crm_attribute_name_value_info, 0, sizeof (struct crm_attribute_name_value_pair));
  of_memset(nwport_name, 0, sizeof(nwport_name));
  if ((crm_nwport_attribute_ucm_setmandparams (keys_arr_p, nwport_name, &crm_attribute_name_value_info, 
					NULL)) != OF_SUCCESS)
   {
     CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
     return OF_FAILURE;
  }

  crm_attribute_output.name_length = CRM_MAX_ATTRIBUTE_NAME_LEN -1;
  crm_attribute_output.value_length = CRM_MAX_ATTRIBUTE_VALUE_LEN -1;

  return_value = crm_get_port_first_attribute(nwport_name, &crm_attribute_output);
  if (return_value != OF_SUCCESS)
   {
     CM_CBK_DEBUG_PRINT ("crm_get_first_nwport_attribute_name failed!");
     return OF_FAILURE;
   }
   result_iv_pairs_p = (struct cm_array_of_iv_pairs *) of_calloc (1, sizeof (struct cm_array_of_iv_pairs));
  if (result_iv_pairs_p == NULL)
  {
    CM_CBK_DEBUG_PRINT ("Memory allocation failed for result_iv_pairs_p");
    return OF_FAILURE;
  }
  crm_attribute_nwport_getparams(&crm_attribute_output, &result_iv_pairs_p[uiRecCount]);
  uiRecCount++;
  *array_of_iv_pair_arr_p = result_iv_pairs_p;
  *count_p = uiRecCount;  
  return CRM_SUCCESS;  
}
Example #26
0
int32_t UCMDP_EndConfigTransaction(uint32_t uiAppId,void * config_trans_p,uint32_t uiCmdId,struct cm_app_result ** result_p)
{
	 char *pTempBuf;;
	 struct cm_app_result *app_result_p=NULL;
	 int32_t iTotalLen=0,return_value;
	 ucmcommmsg_t CommMsg={};

	 pTempBuf=CommMsg.cntlreqmsg.msg;
	 CM_CBK_DEBUG_PRINT(" Entry uiAppId=%d",uiAppId);

#if defined(_LP64)
	 pTempBuf= of_mbuf_put_64(pTempBuf, (unsigned long)config_trans_p);
#else
	 pTempBuf= of_mbuf_put_32(pTempBuf, (uint32_t) config_trans_p);
#endif
	 iTotalLen+=sizeof(long);

	 app_result_p = (struct cm_app_result *)of_calloc(1,sizeof(struct cm_app_result));
	 if(!app_result_p)
	 {
			CM_CBK_DEBUG_PRINT("memory allocation failed");
			return OF_FAILURE;
	 }

	 CM_CNTRL_PREPARE_CNTRL_CFG_REQUEST(CommMsg.cntlreqmsg, uiAppId, uiCmdId, CM_CPDP_APPL_TRANS_END_CMD, sizeof(long), iTotalLen);
	 return_value=UCMCntrlCommHandler(&CommMsg,app_result_p);

	 if(app_result_p->result_code==OF_FAILURE)
	 {
			if ( (return_value == CM_APPL_NULL_CALLBACK))
			{
				 CM_CBK_DEBUG_PRINT("No transaction support. Sending temp trans");
				 return OF_SUCCESS;
			}
			if (return_value == CM_APPL_END_TRANS_FAILED)
			{
				 *result_p = app_result_p ;
				 CM_CBK_DEBUG_PRINT("transaction start failed");
			}
			return OF_FAILURE;
	 }
	 of_free(app_result_p);
	 return OF_SUCCESS;
}
int32_t of_fw4_conntemplates_delrec(void * config_transaction_p,
                        struct cm_array_of_iv_pairs * keys_arr_p,
                        struct cm_app_result ** result_p)
{
  struct cm_app_result *result = NULL;
  int32_t return_value = OF_FAILURE;

  struct fw4_conn_templates_config  config_info={};

  CM_CBK_DEBUG_PRINT ("Entered");
  if ((of_fw4_conntemplates_setmandparams(
                                keys_arr_p, 
                                &config_info, 
                                &result)) != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
    fill_app_result_struct (&result, NULL, CM_GLU_SET_MAND_PARAM_FAILED);
    *result_p = result;
    return OF_FAILURE;
  }

  if((of_fw4_conntemplates_setoptparams(
                               keys_arr_p, 
                               &config_info, 
                               &result)) != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT("Set Optional Parameters Failed");
    fill_app_result_struct(&result, NULL, CM_GLU_SET_OPT_PARAM_FAILED);
    *result_p = result;
    return OF_FAILURE;
  }


  return_value = fw4_del_conn_templates(&config_info);
  if (return_value != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("crm tenant add  Failed");
    fill_app_result_struct (&result, NULL, CM_GLU_CONN_TEMPLATE_DEL_FAILED);
    *result_p = result;
    return OF_FAILURE;
  }
  CM_CBK_DEBUG_PRINT ("connection template record delete successfully");
  return OF_SUCCESS;
}
Example #28
0
int32_t of_queue_getnextnrecs (struct cm_array_of_iv_pairs * pKeysArr,
    struct cm_array_of_iv_pairs *pPrevRecordKey, uint32_t * pCount,
    struct cm_array_of_iv_pairs ** pNextNRecordData_p)
{

  CM_CBK_DEBUG_PRINT ("Entered");
  *pCount=0;
  return OF_FAILURE;

}
Example #29
0
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Function Name:
 * Description:
 * Input:
 * Output:
 * Result:
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32_t of_flow_actionset_ucm_setmandparams (struct cm_array_of_iv_pairs *mand_iv_pairs,
                               struct dprm_datapath_general_info *datapath_info,
                               struct  ofi_flow_mod_info *flow_info,
                               struct ofi_flow_action *flow_action_info,
                               struct cm_app_result ** result_pp)
{
  uint32_t opt_param_cnt;
  uint32_t flow_id;
  uint64_t uidp_id;

  CM_CBK_DEBUG_PRINT ("Entered");
  for (opt_param_cnt = 0; opt_param_cnt < mand_iv_pairs->count_ui; opt_param_cnt++)
  {
      switch (mand_iv_pairs->iv_pairs[opt_param_cnt].id_ui)
      {
	     case CM_DM_DATAPATH_DATAPATHID_ID:
          uidp_id=charTo64bitNum((char *) mand_iv_pairs->iv_pairs[opt_param_cnt].value_p);
          CM_CBK_DEBUG_PRINT("dpid is: %llx",uidp_id);
          if (datapath_info)
          {
              datapath_info->dpid = uidp_id;
          }
          break;
         case CM_DM_FLOWMOD_FLOWID_ID:
            flow_id = of_atoi((char *) mand_iv_pairs->iv_pairs[opt_param_cnt].value_p);
            flow_info->flow_id = flow_id;
            CM_CBK_DEBUG_PRINT ("flow id is %d", flow_id);
            break;
         case CM_DM_ACTIONSET_ACTIONSETID_ID:
            flow_action_info->action_id = 
            of_atoi((char *) mand_iv_pairs->iv_pairs[opt_param_cnt].value_p);
            break;
         case  CM_DM_ACTIONSET_ACTIONSETTYPE_ID:			
            of_flow_set_action_type(flow_action_info,
                 (char *)mand_iv_pairs->iv_pairs[opt_param_cnt].value_p,
                 mand_iv_pairs->iv_pairs[opt_param_cnt].value_length);
            //CM_CBK_DEBUG_PRINT ("flow_actionset type %d %d ",                                flow_action_info->action_type,flow_action_type);
            break;
       }
  }
  CM_CBK_PRINT_IVPAIR_ARRAY (mand_iv_pairs);
  return OF_SUCCESS;
}
int32_t crm_subnet_delrec (void * config_transaction_p,
                        struct cm_array_of_iv_pairs * keys_arr_p,
                        struct cm_app_result ** result_p)
{
  struct cm_app_result *crm_subnet_result = NULL;
  int32_t return_value = OF_FAILURE;
  struct crm_subnet_config_info sub_config_info={};
  uint64_t output_subnet_handle;

   

  CM_CBK_DEBUG_PRINT ("Entered");
  if ((crm_subnet_ucm_setmandparams (keys_arr_p,&sub_config_info , &crm_subnet_result)) !=
           OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
    fill_app_result_struct (&crm_subnet_result, NULL, CM_GLU_SET_MAND_PARAM_FAILED);
    *result_p = crm_subnet_result;
    return OF_FAILURE;
  }

  return_value = crm_subnet_ucm_setoptparams (keys_arr_p,&sub_config_info, &crm_subnet_result);
   if (return_value != OF_SUCCESS)
   {
     CM_CBK_DEBUG_PRINT ("Set Optional Parameters Failed");
     fill_app_result_struct (&crm_subnet_result, NULL, CM_GLU_SET_OPT_PARAM_FAILED);
     *result_p = crm_subnet_result;
     return OF_FAILURE;
   }
  

  return_value =crm_del_subnet(sub_config_info.subnet_name);
  if (return_value != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("crm subnet add  Failed");
    fill_app_result_struct (&crm_subnet_result, NULL, CM_GLU_SUBNET_DEL_FAILED);
    *result_p = crm_subnet_result;
    return OF_FAILURE;
  }
  CM_CBK_DEBUG_PRINT ("CRM subnet delete successfully");
  return OF_SUCCESS;

}