int32_t crm_nwport_attribute_delrec (void * config_transaction_p,
			struct cm_array_of_iv_pairs * keys_arr_p,
			struct cm_app_result ** result_p)
{
  struct cm_app_result *attribute_result = NULL;
  int32_t return_value = OF_FAILURE; 
  struct crm_attribute_name_value_pair attribute_info={};
  char nwport_name[CRM_MAX_VM_NAME_LEN+1]={};

  CM_CBK_DEBUG_PRINT ("Entered");
  of_memset (&attribute_info, 0, sizeof (struct crm_attribute_name_value_pair));

  if ((crm_nwport_attribute_ucm_setmandparams (keys_arr_p, nwport_name, &attribute_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_delete_attribute_from_port(nwport_name, &attribute_info);
  if (return_value != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Delete attribute record failed");
    fill_app_result_struct (&attribute_result, NULL, CM_GLU_ATTRIBUTE_DEL_FAILED);
    *result_p = attribute_result;
    return OF_FAILURE;
  }

  CM_CBK_DEBUG_PRINT ("nwport attribute deleted succesfully");
  return OF_SUCCESS;
}
int32_t crm_nwport_attribute_ucm_validatemandparams (struct cm_array_of_iv_pairs *
			pMandParams,	struct cm_app_result **presult_p)
{
  uint32_t uiMandParamCnt;
  struct cm_app_result *attribute_result = NULL;


  CM_CBK_DEBUG_PRINT ("Entered");
  for (uiMandParamCnt = 0; uiMandParamCnt < pMandParams->count_ui; uiMandParamCnt++)
  {
    switch (pMandParams->iv_pairs[uiMandParamCnt].id_ui)
    {
      case CM_DM_NWPORTATTR_ATTRIBNAME_ID:
        if (pMandParams->iv_pairs[uiMandParamCnt].value_p == NULL)
	{
	  CM_CBK_DEBUG_PRINT ("Attribute Name is NULL");
	  fill_app_result_struct (&attribute_result, NULL, CM_ATTRIBUTE_NAME_NULL);
	  *presult_p = attribute_result;
	  return OF_FAILURE;
	}
	break;
      case CM_DM_NWPORTATTR_ATTRIBVAL_ID: 
	if (pMandParams->iv_pairs[uiMandParamCnt].value_p == NULL)
        {
	  CM_CBK_DEBUG_PRINT ("Attribute Value is NULL");
	  fill_app_result_struct (&attribute_result, NULL, CM_ATTRIBUTE_VAL_NULL);
	  *presult_p = attribute_result;
	  return OF_FAILURE;
	}
	break;
      }
  }
  CM_CBK_PRINT_IVPAIR_ARRAY (pMandParams);
  return OF_SUCCESS;
}
Exemple #3
0
int32_t crm_vm_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_vm_result = NULL;
  int32_t return_value = OF_FAILURE;

  struct crm_vm_config_info  vm_info={};

  CM_CBK_DEBUG_PRINT ("Entered");
  if ((crm_vm_ucm_setmandparams (keys_arr_p, &vm_info, &crm_vm_result)) !=
           OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
    fill_app_result_struct (&crm_vm_result, NULL, CM_GLU_SET_MAND_PARAM_FAILED);
    *result_p = crm_vm_result;
    return OF_FAILURE;
  }
  return_value = crm_del_virtual_machine(vm_info.vm_name);
  if (return_value != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("crm vm add  Failed");
    fill_app_result_struct (&crm_vm_result, NULL, CM_GLU_VM_DEL_FAILED);
    *result_p = crm_vm_result;
    return OF_FAILURE;
  }
  CM_CBK_DEBUG_PRINT ("CRM vm delete successfully");
  return OF_SUCCESS;  

}
int32_t nsrm_appliance_ucm_validatemandparams(struct cm_array_of_iv_pairs *mand_iv_pairs_p,
    struct cm_app_result **  presult_p)
{
  uint32_t count;
  struct cm_app_result *of_appliance_result = NULL;


  CM_CBK_DEBUG_PRINT ("Entered");
  for (count = 0; count < mand_iv_pairs_p->count_ui;count++)
  {
    switch (mand_iv_pairs_p->iv_pairs[count].id_ui)
    {
      case CM_DM_SERVICE_NAME_ID:
        if (mand_iv_pairs_p->iv_pairs[count].value_p == NULL)
        {
          CM_CBK_DEBUG_PRINT ("Appl category name is NULL");
          fill_app_result_struct (&of_appliance_result, NULL, CM_GLU_APPLIANCE_NAME_NULL);
          *presult_p = of_appliance_result;
          return OF_FAILURE;
        }
       case CM_DM_SERVICE_TENANT_ID:
        if (mand_iv_pairs_p->iv_pairs[count].value_p == NULL)
        {
          CM_CBK_DEBUG_PRINT ("Appl tenant name is NULL");
          fill_app_result_struct (&of_appliance_result, NULL, CM_GLU_APPLIANCE_NAME_NULL);
          *presult_p = of_appliance_result;
          return OF_FAILURE;
        }
        break;
       break;
   }
  }
  CM_CBK_PRINT_IVPAIR_ARRAY (mand_iv_pairs_p);
  return OF_SUCCESS;
}
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;
}
Exemple #6
0
 int32_t of_domain_ucm_validatemandparams (struct cm_array_of_iv_pairs *
			pMandParams,
			struct cm_app_result **presult_p)
{
	 uint32_t uiMandParamCnt;
	 struct cm_app_result *of_domain_result = NULL;


	 CM_CBK_DEBUG_PRINT ("Entered");
	 for (uiMandParamCnt = 0; uiMandParamCnt < pMandParams->count_ui;
				 uiMandParamCnt++)
	 {
			switch (pMandParams->iv_pairs[uiMandParamCnt].id_ui)
			{
				 case CM_DM_DOMAIN_NAME_ID:
						if (pMandParams->iv_pairs[uiMandParamCnt].value_p == NULL)
						{
							 CM_CBK_DEBUG_PRINT ("Domain Name is NULL");
							 fill_app_result_struct (&of_domain_result, NULL, CM_GLU_DOMAIN_NAME_NULL);
							 *presult_p = of_domain_result;
							 return OF_FAILURE;
						}
						break;

				 case CM_DM_DOMAIN_SUBJECTNAME_ID: 
						if (pMandParams->iv_pairs[uiMandParamCnt].value_p == NULL)
						{
							 CM_CBK_DEBUG_PRINT ("Subject Name is NULL");
							 fill_app_result_struct (&of_domain_result, NULL, CM_GLU_DOMAIN_SUBJECT_NAME_NULL);
							 *presult_p = of_domain_result;
							 return OF_FAILURE;
						}
						break;
#if 0
				 case CM_DM_DOMAIN_NUMOFTABLES_ID:
						if (pMandParams->iv_pairs[uiMandParamCnt].value_p == NULL)
						{
							 CM_CBK_DEBUG_PRINT ("Number of tables is NULL");
							 fill_app_result_struct (&of_domain_result, NULL, CM_GLU_DOMAIN_NUMOFTABLES_NULL);
							 *presult_p = of_domain_result;
							 return OF_FAILURE;
						}
						uiTableCnt =
           ucm_uint8_from_str_ptr (pMandParams->iv_pairs[uiMandParamCnt].value_p);
						if (uiTableCnt < 0 ||  uiTableCnt > 24)
						{
							 CM_CBK_DEBUG_PRINT ("Number of tables Exceeding its maximum Number");
							 fill_app_result_struct (&of_domain_result, NULL, CM_GLU_DOMAIN_NUMOFTABLES_EXCEEDED);
							 *presult_p = of_domain_result;
							 return OF_FAILURE;
						}
						break;
#endif
			}
	 }
	 CM_CBK_PRINT_IVPAIR_ARRAY (pMandParams);
	 return OF_SUCCESS;
}
Exemple #7
0
int32_t crm_vm_ucm_validatemandparams(struct cm_array_of_iv_pairs *
    mand_iv_pairs_p,
    struct cm_app_result **  presult_p)
{
  uint32_t count;
  struct cm_app_result *of_vm_result = NULL;


  CM_CBK_DEBUG_PRINT ("Entered");
  for (count = 0; count < mand_iv_pairs_p->count_ui;
      count++)
  {
    switch (mand_iv_pairs_p->iv_pairs[count].id_ui)
    {
      case CM_DM_VIRTUALMACHINE_NAME_ID:
	if (mand_iv_pairs_p->iv_pairs[count].value_p == NULL)
        {
          CM_CBK_DEBUG_PRINT ("vm name is NULL");
          fill_app_result_struct (&of_vm_result, NULL, CM_GLU_VM_NAME_NULL);
          *presult_p = of_vm_result;
          return OF_FAILURE;
        }
        break;

      case CM_DM_VIRTUALMACHINE_TYPE_ID:
	if (mand_iv_pairs_p->iv_pairs[count].value_p == NULL)
        {
          CM_CBK_DEBUG_PRINT ("vm type is NULL");
          fill_app_result_struct (&of_vm_result, NULL, CM_GLU_VM_TYPE_NULL);
          *presult_p = of_vm_result;
          return OF_FAILURE;
        }
        break;

      case CM_DM_VIRTUALMACHINE_TENANT_ID:
	if (mand_iv_pairs_p->iv_pairs[count].value_p == NULL)
        {
          CM_CBK_DEBUG_PRINT ("vm tenant is NULL");
          fill_app_result_struct (&of_vm_result, NULL, CM_GLU_TENANT_NAME_NULL);
          *presult_p = of_vm_result;
          return OF_FAILURE;
        }
        break;

      case CM_DM_VIRTUALMACHINE_SWITCH_ID:
	if (mand_iv_pairs_p->iv_pairs[count].value_p == NULL)
        {
          CM_CBK_DEBUG_PRINT ("vm switch is NULL");
          fill_app_result_struct (&of_vm_result, NULL, CM_GLU_SWITCH_NULL);
          *presult_p = of_vm_result;
          return OF_FAILURE;
        }
        break; 
    }
  }
  CM_CBK_PRINT_IVPAIR_ARRAY (mand_iv_pairs_p);
  return OF_SUCCESS;
}
int32_t of_flow_actionset_addrec(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_FAILURE;
	struct ofi_flow_action *flow_action_info = NULL;
	struct ofi_flow_mod_info flow_info = { };
	struct flow_trans *trans_rec=(struct flow_trans *)config_trans_p;

	CM_CBK_DEBUG_PRINT ("Entered");

	flow_action_info =(struct ofi_flow_action *) calloc ( 1, sizeof(struct ofi_flow_action));
	if (flow_action_info == NULL)
	{
     CM_CBK_DEBUG_PRINT ("memory allocation Failed");
     fill_app_result_struct (&of_flow_actionset_result, NULL, CM_GLU_VLAN_FAILED);
     *result_pp =of_flow_actionset_result;
     return OF_FAILURE;
	}

  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");
		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_actionset_ucm_setoptparams (opt_iv_pairs, flow_action_info, 
                                             &of_flow_actionset_result);
	if (return_value != OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("Set Optional 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_add_action_to_list(trans_rec->datapath_handle,
                              flow_action_info, flow_info.flow_id);

	if (return_value != OF_SUCCESS)
	{
      CM_CBK_DEBUG_PRINT ("flow_actionset Addition to flow %d Failed", 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;
}
Exemple #9
0
int32_t nsrm_chain_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 *nsrm_chain_result = NULL;
   int32_t return_value = OF_FAILURE;
   struct nsrm_nschain_object_key *nsrm_chain_key_info =NULL ;
   struct nsrm_nschain_object_config_info *nsrm_chain_config_info = NULL;

   CM_CBK_DEBUG_PRINT ("Entered(nsrm_category_addrec)");

  nsrm_chain_key_info = (struct nsrm_nschain_object_key*) of_calloc(1, sizeof(struct nsrm_nschain_object_key));
  nsrm_chain_config_info = (struct nsrm_nschain_object_config_info *)of_calloc(NSRM_MAX_NSCHAIN_OBJECT_CONFIG_PARAMETERS,sizeof(struct nsrm_nschain_object_config_info));
  if ((nsrm_chain_ucm_setmandparams (pMandParams, nsrm_chain_key_info, nsrm_chain_config_info)) != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
    fill_app_result_struct (&nsrm_chain_result, NULL, CM_GLU_SET_MAND_PARAM_FAILED);
    *result_p=nsrm_chain_result;
    of_free(nsrm_chain_key_info->name_p);
    of_free(nsrm_chain_key_info->tenant_name_p);
    of_free(nsrm_chain_key_info);
    return OF_FAILURE;
  }
 if ((nsrm_chain_ucm_setoptparams (pOptParams, nsrm_chain_config_info)) != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Set Optional Parameters Failed");
    fill_app_result_struct (&nsrm_chain_result, NULL, CM_GLU_SET_MAND_PARAM_FAILED);
    *result_p=nsrm_chain_result;
    of_free(nsrm_chain_key_info->name_p);
    of_free(nsrm_chain_key_info->tenant_name_p);
    of_free(nsrm_chain_key_info);
    return OF_FAILURE;
  }

  return_value = nsrm_modify_nschain_object(nsrm_chain_key_info, 2, nsrm_chain_config_info);
  if (return_value != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("nsrm chain modify  Failed");
    fill_app_result_struct (&nsrm_chain_result, NULL, CM_GLU_NS_CHAIN_MOD_FAILED);
    *result_p = nsrm_chain_result;
    of_free(nsrm_chain_key_info->name_p);
    of_free(nsrm_chain_key_info->tenant_name_p);
    of_free(nsrm_chain_key_info);
    return OF_FAILURE;
  }
  CM_CBK_DEBUG_PRINT ("NSRM chain modified successfully");
    of_free(nsrm_chain_key_info->name_p);
    of_free(nsrm_chain_key_info->tenant_name_p);
    of_free(nsrm_chain_key_info);
  return OF_SUCCESS;
}
int32_t nsrm_selection_rule_attribute_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                    *attribute_result = NULL;
    struct   nsrm_attribute_name_value_pair    nsrm_attribute_name_value_info= {};
    char*    selection_rule_name_p;
    char*    nschainset_object_name_p;
    int32_t  ret_value;

    CM_CBK_DEBUG_PRINT("Entered");
    selection_rule_name_p    = (char*)of_calloc(1,NSRM_MAX_NAME_LENGTH);
    nschainset_object_name_p = (char*)of_calloc(1,NSRM_MAX_NAME_LENGTH);
    if((nsrm_selection_rule_attribute_ucm_setmandparams (
                pMandParams,
                selection_rule_name_p,nschainset_object_name_p,
                &nsrm_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;
        of_free(selection_rule_name_p);
        of_free(nschainset_object_name_p);
        of_free(nsrm_attribute_name_value_info.attribute_name_p);
        of_free(nsrm_attribute_name_value_info.attribute_value_p);
        return OF_FAILURE;
    }

    ret_value = nsrm_add_attribute_to_nschain_selection_rule(selection_rule_name_p,nschainset_object_name_p,
                &nsrm_attribute_name_value_info);
    if (ret_value != OF_SUCCESS)
    {

        CM_CBK_DEBUG_PRINT ("Service Attribute Addition Failed");
        fill_app_result_struct (&attribute_result, NULL, CM_GLU_ATTRIBUTE_ADD_FAILED);
        *result_p = attribute_result;
        of_free(selection_rule_name_p);
        of_free(nschainset_object_name_p);
        of_free(nsrm_attribute_name_value_info.attribute_name_p);
        of_free(nsrm_attribute_name_value_info.attribute_value_p);
        return OF_FAILURE;
    }
    CM_CBK_DEBUG_PRINT ("Attribute added succesfully");
    of_free(selection_rule_name_p);
    of_free(nschainset_object_name_p);
    of_free(nsrm_attribute_name_value_info.attribute_name_p);
    of_free(nsrm_attribute_name_value_info.attribute_value_p);
    return OF_SUCCESS;

}
Exemple #11
0
int32_t nsrm_bypassrule_delrec (void * config_transaction_p,
                        struct cm_array_of_iv_pairs * keys_arr_p,
                        struct cm_app_result ** result_p)
{

   struct cm_app_result *nsrm_bypassrule_result = NULL;
  int32_t return_value = OF_FAILURE;
   struct nsrm_nwservice_bypass_rule_key *nsrm_bypassrule_key_info;
   struct nsrm_nwservice_bypass_rule_config_info *nsrm_bypassrule_config_info;
  struct nsrm_nschain_object_key*     nschain_object_key_p;

  CM_CBK_DEBUG_PRINT ("Entered");
  nschain_object_key_p = (struct nsrm_nschain_object_key *) 
	  of_calloc(1, sizeof(struct nsrm_nschain_object_key));
  nsrm_bypassrule_key_info = (struct nsrm_nwservice_bypass_rule_key*) 
                        of_calloc(1, sizeof(struct nsrm_nwservice_bypass_rule_key));
  nsrm_bypassrule_config_info = (struct nsrm_nwservice_bypass_rule_config_info *) 
                          of_calloc(1, sizeof(struct nsrm_nwservice_bypass_rule_config_info));
  if ((nsrm_bypassrule_ucm_setmandparams (keys_arr_p, nsrm_bypassrule_key_info,
                     nschain_object_key_p, nsrm_bypassrule_config_info)) !=OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
    fill_app_result_struct (&nsrm_bypassrule_result, NULL, CM_GLU_SET_MAND_PARAM_FAILED);
    *result_p = nsrm_bypassrule_result;
    of_free(nsrm_bypassrule_key_info->name_p);
    of_free(nsrm_bypassrule_key_info->tenant_name_p);
    of_free(nsrm_bypassrule_key_info->nschain_object_name_p);
    of_free(nsrm_bypassrule_key_info);
    return OF_FAILURE;
  }
  return_value = nsrm_del_nwservice_bypass_rule_from_nschain_object (nsrm_bypassrule_key_info);
  if (return_value != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("nsrm bypassrule add  Failed");
    fill_app_result_struct (&nsrm_bypassrule_result, NULL, CM_GLU_BYPASS_RULE_DEL_FAILED);
    *result_p = nsrm_bypassrule_result;
    of_free(nsrm_bypassrule_key_info->name_p);
    of_free(nsrm_bypassrule_key_info->tenant_name_p);
    of_free(nsrm_bypassrule_key_info->nschain_object_name_p);
    of_free(nsrm_bypassrule_key_info);
    return OF_FAILURE;
  }
  CM_CBK_DEBUG_PRINT ("NSRM Appliance delete successfully");
    of_free(nsrm_bypassrule_key_info->name_p);
    of_free(nsrm_bypassrule_key_info->tenant_name_p);
    of_free(nsrm_bypassrule_key_info->nschain_object_name_p);
    of_free(nsrm_bypassrule_key_info);
  return OF_SUCCESS;

}
Exemple #12
0
int32_t of_domain_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 *of_domain_result= NULL;
	 int32_t return_value = OF_FAILURE;
	 struct dprm_distributed_forwarding_domain_info of_domain = { };
	 uint64_t domain_handle;


	 CM_CBK_DEBUG_PRINT ("Entered");
	 of_memset (&of_domain, 0, sizeof (struct dprm_distributed_forwarding_domain_info));

	 if ((of_domain_ucm_setmandparams (pMandParams, &of_domain, &of_domain_result)) !=
				 OF_SUCCESS)
	 {
			CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
			*result_p=of_domain_result;
			return OF_FAILURE;
	 }

	 return_value = of_domain_ucm_setoptparams (pOptParams, &of_domain, &of_domain_result);
	 if (return_value != OF_SUCCESS)
	 {
			CM_CBK_DEBUG_PRINT ("Set Optional Parameters Failed");
			*result_p = of_domain_result;
			return OF_FAILURE;
	 }

	 return_value=dprm_get_switch_handle(of_domain.name, &domain_handle);
	 if (return_value != OF_SUCCESS)
	 {
			CM_CBK_DEBUG_PRINT ("Error: name framing failed");
			fill_app_result_struct (&of_domain_result, NULL, CM_GLU_VLAN_FAILED);
			*result_p = of_domain_result;
			return OF_FAILURE;
	 }

	 return_value = dprm_update_switch(domain_handle,&of_domain);
	 if (return_value != OF_SUCCESS)
	 {
			CM_CBK_DEBUG_PRINT ("switch updation Failed");
			fill_app_result_struct (&of_domain_result, NULL, CM_GLU_VLAN_FAILED);
			*result_p = of_domain_result;
			return OF_FAILURE;
	 }

	 return OF_SUCCESS;
}
Exemple #13
0
int32_t of_flow_addrec (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");

	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 = of_flow_ucm_setoptparams (opt_iv_pairs, &flow_info, &flow_result);
	if (return_value != OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("Set Optional 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;
	}
	

	return_value = of_datapath_update_flow(datapath_handle, &flow_info);
	if (return_value != OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("Flow Addition Failed");
		fill_app_result_struct (&flow_result, NULL, CM_GLU_FLOW_ADD_FAILED);
		*result_pp =flow_result;
		return OF_FAILURE;
	}

	return OF_SUCCESS;
}
int32_t dprm_datapath_dpattribute_delrec (void * config_transaction_p,
			struct cm_array_of_iv_pairs * keys_arr_p,
			struct cm_app_result ** result_p)
{
	 struct cm_app_result *dpattribute_result = NULL;
	 int32_t return_value = OF_FAILURE;
	 struct dprm_attribute_name_value_pair dpattribute_info={};
	 struct dprm_datapath_general_info datapath_info={};
	 uint64_t datapath_handle;
	 uint64_t port_handle;

	 CM_CBK_DEBUG_PRINT ("Entered");
	 of_memset (&dpattribute_info, 0, sizeof (struct dprm_attribute_name_value_pair));

	 if ((dprm_datapath_dpattribute_ucm_setmandparams (keys_arr_p, &datapath_info, &dpattribute_info, &dpattribute_result)) != OF_SUCCESS)
	 {
			CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
			fill_app_result_struct (&dpattribute_result, NULL, CM_GLU_SET_MAND_PARAM_FAILED);
			*result_p = dpattribute_result;
			return OF_FAILURE;
	 }

	 return_value=dprm_get_datapath_handle(datapath_info.dpid, &datapath_handle);
	 if (return_value != OF_SUCCESS)
	 {
			CM_CBK_DEBUG_PRINT ("Get datapath handle failed");
			fill_app_result_struct (&dpattribute_result, NULL, CM_GLU_NO_MATCHING_PORT_RECORD);
			*result_p = dpattribute_result;
			return OF_FAILURE;
	 }
	CM_CBK_DEBUG_PRINT("value string is %s",(&dpattribute_info)->value_string);
	 if(dpattribute_info.value_string[0] == '\0'){
	 	 CM_CBK_DEBUG_PRINT ("Value string is null");
		 return_value=dprm_delete_all_attribute_values_from_datapath(datapath_handle, &dpattribute_info);
	 }
	 else{
		 return_value=dprm_delete_attribute_from_datapath(datapath_handle, &dpattribute_info);
	 }
	 if (return_value != OF_SUCCESS)
	 {
			CM_CBK_DEBUG_PRINT ("Delete datapath attribute record failed");
			fill_app_result_struct (&dpattribute_result, NULL, CM_GLU_PORT_DELETE_FAILED);
			*result_p = dpattribute_result;
			return OF_FAILURE;
	 }

         CM_CBK_DEBUG_PRINT ("Datapath attribute deleted succesfully");
	 return OF_SUCCESS;
}
int32_t nsrm_selection_rule_attribute_delrec (void * config_transaction_p,
        struct cm_array_of_iv_pairs * keys_arr_p,
        struct cm_app_result ** result_p)
{
    struct   cm_app_result                    *attribute_result = NULL;
    struct   nsrm_attribute_name_value_pair    nsrm_attribute_name_value_info= {};
    char*    selection_rule_name_p;
    char*    nschainset_object_name_p;
    int32_t  ret_value;

    selection_rule_name_p    = (char*)of_calloc(1,NSRM_MAX_NAME_LENGTH);
    nschainset_object_name_p = (char*)of_calloc(1,NSRM_MAX_NAME_LENGTH);
    if((nsrm_selection_rule_attribute_ucm_setmandparams (
                keys_arr_p,
                selection_rule_name_p,nschainset_object_name_p,
                &nsrm_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;
        of_free(selection_rule_name_p);
        of_free(nschainset_object_name_p);
        of_free(nsrm_attribute_name_value_info.attribute_name_p);
        of_free(nsrm_attribute_name_value_info.attribute_value_p);
        return OF_FAILURE;
    }

    ret_value = nsrm_del_attribute_from_nschain_selection_rule(selection_rule_name_p,nschainset_object_name_p,
                nsrm_attribute_name_value_info.attribute_name_p);
    if (ret_value != OF_SUCCESS)
    {
        CM_CBK_DEBUG_PRINT ("Delete attribute record failed");
        fill_app_result_struct (&attribute_result, NULL, CM_GLU_ATTRIBUTE_DEL_FAILED);
        *result_p = attribute_result;
        of_free(selection_rule_name_p);
        of_free(nschainset_object_name_p);
        of_free(nsrm_attribute_name_value_info.attribute_name_p);
        of_free(nsrm_attribute_name_value_info.attribute_value_p);
        return OF_FAILURE;
    }

    CM_CBK_DEBUG_PRINT ("service attribute deleted succesfully");
    of_free(selection_rule_name_p);
    of_free(nschainset_object_name_p);
    of_free(nsrm_attribute_name_value_info.attribute_name_p);
    of_free(nsrm_attribute_name_value_info.attribute_value_p);
    return OF_SUCCESS;
}
int32_t crm_port_attribute_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 *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 Addition Failed(ret:%d",return_value);
    fill_app_result_struct (&attribute_result, NULL, CM_GLU_ATTRIBUTE_ADD_FAILED);
    *result_p = attribute_result;
    return OF_FAILURE;
  }
  CM_CBK_DEBUG_PRINT ("Attribute added succesfully");
  return OF_SUCCESS;

}
Exemple #17
0
int32_t of_tracelog_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 *trace_result=NULL;
  uint16_t trace_module_set = 0,param_count;
  uint8_t  is_trace_level_set =0;
  CM_CBK_DEBUG_PRINT ("Entered");
  for (param_count = 0; param_count < key_iv_pairs_p->count_ui;
      param_count++)
  {
    switch (key_iv_pairs_p->iv_pairs[param_count].id_ui)
    {
      case CM_DM_TRACE_MODULE_ID:
          trace_module_set = 1;
        break;
    }
  }
   if(trace_module_set == 0){
    fill_app_result_struct (&trace_result, NULL, CM_GLU_TRACE_MODULE_REQUIRED);
    CM_CBK_DEBUG_PRINT ("Validate Optional Parameters Failed");
    *result_p = trace_result;
    return OF_FAILURE;
  }
  else{
    *result_p = trace_result;
    return OF_SUCCESS;
  }
}
Exemple #18
0
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Function Name:
 * Description:
 * Input:
 * Output:
 * Result:
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32_t of_flow_match_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_match_result = NULL;
	int32_t return_value = OF_FAILURE;
	struct dprm_switch_runtime_info runtime_info;
	struct flow_trans *trans_rec=config_trans_p;


	CM_CBK_DEBUG_PRINT ("Entered");

#if 0
	if ((of_flow_match_ucm_setmandparams (mand_iv_pairs,&flow_info, &bucket_info, &of_flow_match_result)) !=
			OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
		*result_pp=of_flow_match_result;
		return OF_FAILURE;
	}


	return_value=of_flow_match_unregister_buckets(bucket_info.flow_id);
	if (return_value != OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("Error: flow doesn't exists with name %d",bucket_info.flow_id);
		fill_app_result_struct (&of_flow_match_result, NULL, CM_GLU_VLAN_FAILED);
		*result_pp =of_flow_match_result;
		return OF_FAILURE;
	}
#endif 
	return OF_FAILURE;
}
Exemple #19
0
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Function Name:
 * Description:
 * Input:
 * Output:
 * Result:
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32_t of_action_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)
{

	CM_CBK_DEBUG_PRINT ("Entered");
#if 0
	if ((of_action_ucm_set_mand_params (mand_iv_pairs,&group_info, &bucket_info, &of_action_result)) !=
			OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
		*result_pp=of_action_result;
		return OF_FAILURE;
	}


	return_value=of_action_unregister_buckets(bucket_info.group_id);
	if (return_value != OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("Error: group doesn't exists with name %d",bucket_info.group_id);
		fill_app_result_struct (&of_action_result, NULL, CM_GLU_VLAN_FAILED);
		*result_pp =of_action_result;
		return OF_FAILURE;
	}

#endif 
	return OF_FAILURE;
}
Exemple #20
0
int32_t of_bindstats_ucm_validatemandparams (struct cm_array_of_iv_pairs *
    pMandParams,	struct cm_app_result **ppResult)
{
  uint32_t uiMandParamCnt;
  struct cm_app_result *stats_result = NULL;


  CM_CBK_DEBUG_PRINT ("Entered");
  for (uiMandParamCnt = 0; uiMandParamCnt < pMandParams->count_ui;
      uiMandParamCnt++)
  {
    switch (pMandParams->iv_pairs[uiMandParamCnt].id_ui)
    {
      case CM_DM_BINDSTATS_BIND_OBJ_ID_ID:  
        if (pMandParams->iv_pairs[uiMandParamCnt].value_p == NULL)
        {
          CM_CBK_DEBUG_PRINT ("bind obj ID is NULL");
          fill_app_result_struct (&stats_result, NULL, CM_GLU_TABLE_ID_NULL);
          *ppResult = stats_result;
          return OF_FAILURE;
        }
        break;

    }
  }
  CM_CBK_PRINT_IVPAIR_ARRAY (pMandParams);
  return OF_SUCCESS;
}
Exemple #21
0
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Function Name:
 * Description:
 * Input:
 * Output:
 * Result:
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32_t of_flow_delrec (void * config_trans_p,
		struct cm_array_of_iv_pairs * key_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;
  struct flow_trans *trans_rec=(struct flow_trans *)config_trans_p;

	CM_CBK_DEBUG_PRINT ("Entered");

	if ((of_flow_ucm_setmandparams (key_iv_pairs,&datapath_info, &flow_info, &flow_result)) !=
			OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
		fill_app_result_struct (&flow_result, NULL, CM_GLU_SET_MAND_PARAM_FAILED);
		*result_pp =flow_result;
		return OF_FAILURE;
	}
  trans_rec->table_id = flow_info.table_id;
  trans_rec->priority = flow_info.priority;

	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
	return_value=of_datapath_remove_static_flow(datapath_handle, flow_info.flow_id);
	if (return_value != OF_SUCCESS)
	{
		CM_CBK_DEBUG_PRINT ("Flow does not exist with id %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;
}
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;
}
Exemple #23
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;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 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;
}
Exemple #25
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;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 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;
}
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;
}
Exemple #28
0
int32_t of_domain_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 *of_domain_result = NULL;
	 int32_t return_value = OF_FAILURE;
	 struct dprm_distributed_forwarding_domain_info of_domain = { };
	 uint64_t domain_handle;

	 CM_CBK_DEBUG_PRINT ("Entered");
	 of_memset (&of_domain, 0, sizeof (struct dprm_distributed_forwarding_domain_info ));

	 if ((of_domain_ucm_setmandparams (pMandParams, &of_domain, &of_domain_result)) !=
				 OF_SUCCESS)
	 {
			CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
			fill_app_result_struct (&of_domain_result, NULL, CM_GLU_SET_MAND_PARAM_FAILED);
			*result_p=of_domain_result;
			return OF_FAILURE;
	 }

	 return_value = of_domain_ucm_setoptparams (pOptParams, &of_domain, &of_domain_result);
	 if (return_value != OF_SUCCESS)
	 {
			CM_CBK_DEBUG_PRINT ("Set Optional Parameters Failed");
			fill_app_result_struct (&of_domain_result, NULL, CM_GLU_SET_OPT_PARAM_FAILED);
			*result_p = of_domain_result;
			return OF_FAILURE;
	 }
	 
	 return_value = dprm_create_distributed_forwarding_domain(&of_domain,&domain_handle);
	 if (return_value != OF_SUCCESS)
	 {
			CM_CBK_DEBUG_PRINT ("Domain Addition Failed");
			fill_app_result_struct (&of_domain_result, NULL, CM_GLU_DOMAIN_ADD_FAILED);
			*result_p = of_domain_result;
			return OF_FAILURE;
	 }

			CM_CBK_DEBUG_PRINT ("Successfully added domain");
	 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;

}
Exemple #30
0
int32_t nsrm_chain_delrec (void * config_transaction_p,
                        struct cm_array_of_iv_pairs * keys_arr_p,
                        struct cm_app_result ** result_p)
{

   struct cm_app_result *nsrm_chain_result = NULL;
  int32_t return_value = OF_FAILURE;

   struct nsrm_nschain_object_key *nsrm_chain_key_info;
   struct nsrm_nschain_object_config_info *nsrm_chain_config_info = NULL;

  CM_CBK_DEBUG_PRINT ("Entered");
  nsrm_chain_key_info = (struct nsrm_nschain_object_key*) of_calloc(1, sizeof(struct nsrm_nschain_object_key));
  nsrm_chain_config_info = (struct nsrm_nschain_object_config_info *)of_calloc(NSRM_MAX_NSCHAIN_OBJECT_CONFIG_PARAMETERS,sizeof(struct nsrm_nschain_object_config_info ));

  if ((nsrm_chain_ucm_setmandparams (keys_arr_p, nsrm_chain_key_info, nsrm_chain_config_info)) !=OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("Set Mandatory Parameters Failed");
    fill_app_result_struct (&nsrm_chain_result, NULL, CM_GLU_SET_MAND_PARAM_FAILED);
    *result_p = nsrm_chain_result;
    of_free(nsrm_chain_key_info->name_p);
    of_free(nsrm_chain_key_info->tenant_name_p);
    of_free(nsrm_chain_key_info);
    return OF_FAILURE;
  }
  return_value = nsrm_del_nschain_object(nsrm_chain_key_info);
  if (return_value != OF_SUCCESS)
  {
    CM_CBK_DEBUG_PRINT ("nsrm chain add  Failed");
    fill_app_result_struct (&nsrm_chain_result, NULL, CM_GLU_NS_CHAIN_DEL_FAILED);
    *result_p = nsrm_chain_result;
    of_free(nsrm_chain_key_info->name_p);
    of_free(nsrm_chain_key_info->tenant_name_p);
    of_free(nsrm_chain_key_info);
    return OF_FAILURE;
  }
  CM_CBK_DEBUG_PRINT ("NSRM Appliance delete successfully");
    of_free(nsrm_chain_key_info->name_p);
    of_free(nsrm_chain_key_info->tenant_name_p);
    of_free(nsrm_chain_key_info);
  return OF_SUCCESS;

}